kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] drivers/mtd/maps: Eliminate use after free
@ 2010-04-02 12:47 Julia Lawall
  2010-04-27  7:19 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2010-04-02 12:47 UTC (permalink / raw)
  To: David Woodhouse, linux-mtd, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Moved the debugging message before the call to map_destroy, which frees its
argument.  The message is also slightly changed to reflect its new
position.

A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression E,E2;
@@

del_mtd_device(E)
...
(
  E = E2
|
* E
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/mtd/maps/pcmciamtd.c        |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index 87b2b8f..3e339de 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -689,8 +689,8 @@ static void pcmciamtd_detach(struct pcmcia_device *link)
 
 	if(dev->mtd_info) {
 		del_mtd_device(dev->mtd_info);
+		info("mtd%d: Removing", dev->mtd_info->index);
 		map_destroy(dev->mtd_info);
-		info("mtd%d: Removed", dev->mtd_info->index);
 	}
 
 	pcmciamtd_release(link);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] drivers/mtd/maps: Eliminate use after free
  2010-04-02 12:47 [PATCH 2/3] drivers/mtd/maps: Eliminate use after free Julia Lawall
@ 2010-04-27  7:19 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2010-04-27  7:19 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-mtd, kernel-janitors, David Woodhouse, linux-kernel

On Fri, 2010-04-02 at 14:47 +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> Moved the debugging message before the call to map_destroy, which frees its
> argument.  The message is also slightly changed to reflect its new
> position.
> 
> A simplified version of the semantic patch that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)

Pushed to l2-mtd-2.6.git, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-27  7:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-02 12:47 [PATCH 2/3] drivers/mtd/maps: Eliminate use after free Julia Lawall
2010-04-27  7:19 ` Artem Bityutskiy

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).