[PATCH] Memory corruption in block2mtd.c

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ingo van Lil
Date: Thursday, March 20, 2008 - 7:36 am

Hello everybody,

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.

Cheers,
Ingo

Signed-off-by: Ingo van Lil <inguin@gmx.de>
---

--- linux-2.6.23.1/drivers/mtd/devices/block2mtd.c.orig	2008-03-20 15:13:49.000000000 +0100
+++ linux-2.6.23.1/drivers/mtd/devices/block2mtd.c	2008-03-20 15:14:09.000000000 +0100
@@ -408,7 +408,6 @@
  	if (token[1]) {
  		ret = parse_num(&erase_size, token[1]);
  		if (ret) {
-			kfree(name);
  			parse_err("illegal erase size");
  		}
  	}
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Memory corruption in block2mtd.c, Ingo van Lil, (Thu Mar 20, 7:36 am)
Re: [PATCH] Memory corruption in block2mtd.c, Jörn, (Thu Mar 20, 10:35 am)