linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MTD: FTL layer: don't free input argument in add_mtd_blktrans_dev
@ 2011-01-08 23:25 Maxim Levitsky
  2011-01-18  8:32 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Levitsky @ 2011-01-08 23:25 UTC (permalink / raw)
  To: linux-mtd; +Cc: enh, David Woodhouse, Maxim Levitsky, nnk

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@gmail.com>
CC: nnk@google.com
CC: enh@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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MTD: FTL layer: don't free input argument in add_mtd_blktrans_dev
  2011-01-08 23:25 [PATCH] MTD: FTL layer: don't free input argument in add_mtd_blktrans_dev Maxim Levitsky
@ 2011-01-18  8:32 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2011-01-18  8:32 UTC (permalink / raw)
  To: Maxim Levitsky; +Cc: David Woodhouse, enh, linux-mtd, nnk

On Sun, 2011-01-09 at 01:25 +0200, Maxim Levitsky wrote:
> 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@gmail.com>

Signed-off-by, (off, not of). I'll fix this.

I'll change your subject line to:

mtd: mtd_blkdevs: fix double free on error path

a) We use "mtd:" prefix, not "MTD:".
b). mtd_blkdevs is not really an FTL layer, I think.
c). The subject line has to make it obvious whether this is a bugfix or
something else - it makes life of people who look at commit messages ans
search for stuff important stuff easier. Your subject line is
technically correct, but not very helpful.

Anyway, picked to l2-mtd-2.6.git, thanks!

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-18  8:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-08 23:25 [PATCH] MTD: FTL layer: don't free input argument in add_mtd_blktrans_dev Maxim Levitsky
2011-01-18  8:32 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).