mtd: memory corruption in block2mtd.c

The block2mtd driver (drivers/mtd/devices/block2mtd.c) will kfree an on-stack
pointer when handling an invalid argument line (e.g.
block2mtd=/dev/loop0,xxx).

The kfree was added some time ago when "name" was dynamically allocated.

Signed-off-by: Ingo van Lil <[email protected]>
Acked-by: Joern Engel <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Ingo van Lil 2008-03-24 12:29:44 -07:00 • committed by Linus Torvalds
commit 2875fb65f8

View file

@ -408,7 +408,6 @@ static int block2mtd_setup2(const char *val)
if (token[1]) {
ret = parse_num(&erase_size, token[1]);
if (ret) {
kfree(name);
parse_err("illegal erase size");
}
}