Skip to content

Commit 34bd283

Browse files
atull-alteragregkh
authored andcommitted
fpga: do not access region struct after fpga_region_unregister
A couple drivers were accessing the region struct after it had been freed. Save off the pointer to the mgr before the region struct gets freed. Signed-off-by: Alan Tull <atull@kernel.org> Acked-by: Moritz Fischer <mdf@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 41e270f commit 34bd283

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

drivers/fpga/dfl-fme-region.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
#include <linux/module.h>
17+
#include <linux/fpga/fpga-mgr.h>
1718
#include <linux/fpga/fpga-region.h>
1819

1920
#include "dfl-fme-pr.h"
@@ -66,9 +67,10 @@ static int fme_region_probe(struct platform_device *pdev)
6667
static int fme_region_remove(struct platform_device *pdev)
6768
{
6869
struct fpga_region *region = dev_get_drvdata(&pdev->dev);
70+
struct fpga_manager *mgr = region->mgr;
6971

7072
fpga_region_unregister(region);
71-
fpga_mgr_put(region->mgr);
73+
fpga_mgr_put(mgr);
7274

7375
return 0;
7476
}

drivers/fpga/of-fpga-region.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,10 @@ static int of_fpga_region_probe(struct platform_device *pdev)
437437
static int of_fpga_region_remove(struct platform_device *pdev)
438438
{
439439
struct fpga_region *region = platform_get_drvdata(pdev);
440+
struct fpga_manager *mgr = region->mgr;
440441

441442
fpga_region_unregister(region);
442-
fpga_mgr_put(region->mgr);
443+
fpga_mgr_put(mgr);
443444

444445
return 0;
445446
}

0 commit comments

Comments
 (0)