mtd: maps: Eliminate use after free
authorJulia Lawall <julia@diku.dk>
Fri, 2 Apr 2010 12:47:38 +0000 (14:47 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 10 May 2010 13:22:55 +0000 (14:22 +0100)
commit258006d1abcf3f2990d3ebd77d75af335ff24d81
tree80d44a8767e365c33a247f63a9365cfcac05cbb6
parentc4e773764cead9358fd4b036d1b883fff3968513
mtd: maps: Eliminate use after free

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>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/maps/pcmciamtd.c