summaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2010-10-21 03:01:15 +0200
committerDavid S. Miller <davem@davemloft.net>2010-10-24 23:47:48 +0200
commit759a6c768dcdbbb4d3f1fb965b674c15773e09ca (patch)
treeae167ac4b6ba9cc212115c3b51bd8aa3376b7a6e /drivers/net/can
parentcan: at91_can: fix reception of extended frames (diff)
downloadlinux-759a6c768dcdbbb4d3f1fb965b674c15773e09ca.tar.xz
linux-759a6c768dcdbbb4d3f1fb965b674c15773e09ca.zip
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: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/at91_can.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 3b66c6736832..2c17e7437c47 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1101,7 +1101,7 @@ static int __init at91_can_probe(struct platform_device *pdev)
return 0;
exit_free:
- free_netdev(dev);
+ free_candev(dev);
exit_iounmap:
iounmap(addr);
exit_release:
@@ -1122,8 +1122,6 @@ static int __devexit at91_can_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL);
- free_netdev(dev);
-
iounmap(priv->reg_base);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1131,6 +1129,8 @@ static int __devexit at91_can_remove(struct platform_device *pdev)
clk_put(priv->clk);
+ free_candev(dev);
+
return 0;
}