From: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Subject: [PATCH 03/10] can: at91_can: fix use after free of priv
Date: Thu, 21 Oct 2010 13:01:15 +0200 [thread overview]
Message-ID: <1287658882-26914-4-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1287658882-26914-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
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-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
drivers/net/can/at91_can.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 3b66c67..2c17e74 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;
}
--
1.7.0.4
next prev parent reply other threads:[~2010-10-21 11:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 11:01 [PATCH 00/10] can: at91: bugfixes and improvements Marc Kleine-Budde
[not found] ` <1287658882-26914-1-git-send-email-mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-10-21 11:01 ` [PATCH 01/10] can: at91_can: use correct bit to enable CAN_CTRLMODE_3_SAMPLES Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 02/10] can: at91_can: fix reception of extended frames Marc Kleine-Budde
2010-10-21 11:01 ` Marc Kleine-Budde [this message]
2010-10-21 11:01 ` [PATCH 04/10] can: at91_can: fix compiler warning in at91_irq_err_state Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 05/10] can: at91_can: fix section mismatch warning Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 06/10] can: at91_can: implement and use at91_get_berr_counter Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 07/10] can: at91_can: set bittiming in chip_start Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 08/10] can: at91_can: convert readl, writel their __raw pendants Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 09/10] can: at91_can: convert dev_<level> printing to netdev_<level> Marc Kleine-Budde
2010-10-21 11:01 ` [PATCH 10/10] can: at91_can: add KBUILD_MODNAME to bittiming constant Marc Kleine-Budde
2010-10-24 21:48 ` [PATCH 00/10] can: at91: bugfixes and improvements David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1287658882-26914-4-git-send-email-mkl@pengutronix.de \
--to=mkl-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).