From 9a27586d3d5c3157260b055d057c6f4f6654c72c Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 21 Oct 2010 05:07:58 +0000 Subject: [PATCH] can: flexcan: fix use after free of priv The priv is part of the memory allocated by alloc_candev(). This patch moved the free it after last usage of priv. Signed-off-by: Marc Kleine-Budde Signed-off-by: David S. Miller --- drivers/net/can/flexcan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index ef443a090ba7..d4990568baee 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -992,7 +992,6 @@ static int __devexit flexcan_remove(struct platform_device *pdev) unregister_flexcandev(dev); platform_set_drvdata(pdev, NULL); - free_candev(dev); iounmap(priv->base); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -1000,6 +999,8 @@ static int __devexit flexcan_remove(struct platform_device *pdev) clk_put(priv->clk); + free_candev(dev); + return 0; } -- 2.30.2