Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34bd2833 authored by Alan Tull's avatar Alan Tull Committed by Greg Kroah-Hartman
Browse files

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: default avatarAlan Tull <atull@kernel.org>
Acked-by: default avatarMoritz Fischer <mdf@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 41e270f6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
 */

#include <linux/module.h>
#include <linux/fpga/fpga-mgr.h>
#include <linux/fpga/fpga-region.h>

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

	fpga_region_unregister(region);
	fpga_mgr_put(region->mgr);
	fpga_mgr_put(mgr);

	return 0;
}
+2 −1
Original line number Diff line number Diff line
@@ -437,9 +437,10 @@ static int of_fpga_region_probe(struct platform_device *pdev)
static int of_fpga_region_remove(struct platform_device *pdev)
{
	struct fpga_region *region = platform_get_drvdata(pdev);
	struct fpga_manager *mgr = region->mgr;

	fpga_region_unregister(region);
	fpga_mgr_put(region->mgr);
	fpga_mgr_put(mgr);

	return 0;
}