Commit 2875fb65 authored by Ingo van Lil's avatar Ingo van Lil Committed by Linus Torvalds

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: default avatarIngo van Lil <inguin@gmx.de>
Acked-by: default avatarJoern Engel <joern@lazybastard.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: <stable@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1312848e
...@@ -408,7 +408,6 @@ static int block2mtd_setup2(const char *val) ...@@ -408,7 +408,6 @@ static int block2mtd_setup2(const char *val)
if (token[1]) { if (token[1]) {
ret = parse_num(&erase_size, token[1]); ret = parse_num(&erase_size, token[1]);
if (ret) { if (ret) {
kfree(name);
parse_err("illegal erase size"); parse_err("illegal erase size");
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment