Commit 759a6c76 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde Committed by David S. Miller

can: at91_can: 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.

While there convert all free_netdev() to free_candev() (which is currently
just a wrapper around free_netdev()) to be symetrically with the allocation
via alloc_candev().
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8a0e0a49
...@@ -1101,7 +1101,7 @@ static int __init at91_can_probe(struct platform_device *pdev) ...@@ -1101,7 +1101,7 @@ static int __init at91_can_probe(struct platform_device *pdev)
return 0; return 0;
exit_free: exit_free:
free_netdev(dev); free_candev(dev);
exit_iounmap: exit_iounmap:
iounmap(addr); iounmap(addr);
exit_release: exit_release:
...@@ -1122,8 +1122,6 @@ static int __devexit at91_can_remove(struct platform_device *pdev) ...@@ -1122,8 +1122,6 @@ static int __devexit at91_can_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
free_netdev(dev);
iounmap(priv->reg_base); iounmap(priv->reg_base);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...@@ -1131,6 +1129,8 @@ static int __devexit at91_can_remove(struct platform_device *pdev) ...@@ -1131,6 +1129,8 @@ static int __devexit at91_can_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