Commit 9a27586d authored by Marc Kleine-Budde's avatar Marc Kleine-Budde Committed by David S. Miller

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: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 06d6e6d2
...@@ -992,7 +992,6 @@ static int __devexit flexcan_remove(struct platform_device *pdev) ...@@ -992,7 +992,6 @@ static int __devexit flexcan_remove(struct platform_device *pdev)
unregister_flexcandev(dev); unregister_flexcandev(dev);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
free_candev(dev);
iounmap(priv->base); iounmap(priv->base);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...@@ -1000,6 +999,8 @@ static int __devexit flexcan_remove(struct platform_device *pdev) ...@@ -1000,6 +999,8 @@ static int __devexit flexcan_remove(struct platform_device *pdev)
clk_put(priv->clk); clk_put(priv->clk);
free_candev(dev);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment