From b97d04063c13532a074e76aca2f19708cd31dd21 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Sun, 9 Jan 2011 01:25:06 +0200 Subject: [PATCH] mtd: mtd_blkdevs: fix double free on error path This one liner patch fixes double free that will occur if add_mtd_blktrans_dev fails. On failure it frees the 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 Commit message tweaked by Artem. Signed-off-by: Maxim Levitsky Signed-off-by: Artem Bityutskiy Signed-off-by: David Woodhouse Cc: stable@kernel.org --- drivers/mtd/mtd_blkdevs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index cb20c67995d8b..e0a2373bf0e2f 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; } -- 2.39.5