[PATCH] MTD: FTL layer: don't free input argument in add_mtd_blktrans_dev

Maxim Levitsky maximlevitsky at gmail.com
Sat Jan 8 18:25:06 EST 2011


This one liner patch fixes double free that will occur if add_mtd_blktrans_dev
fails. On failure it free input argument, but all its users
also free it on error which is natural thing to do.
Thus don't free it.

All credit for finding that bug belongs to reporters of the bug in the android bugzilla
http://code.google.com/p/android/issues/detail?id=13761

Signed-of-by: Maxim Levitsky <maximlevitsky at gmail.com>
CC: nnk at google.com
CC: enh at google.com
---
 drivers/mtd/mtd_blkdevs.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index cb20c67..e0a2373 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -413,7 +413,6 @@ error3:
 error2:
 	list_del(&new->list);
 error1:
-	kfree(new);
 	return ret;
 }
 
-- 
1.7.1




More information about the linux-mtd mailing list