Skip to content

Commit

Permalink
mtd: mtd_blkdevs: fix double free on error path
Browse files Browse the repository at this point in the history
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 <maximlevitsky@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Cc: stable@kernel.org
  • Loading branch information
Maxim Levitsky authored and David Woodhouse committed Mar 11, 2011
1 parent 82013d9 commit bd637f6
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion drivers/mtd/mtd_blkdevs.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
error2:
list_del(&new->list);
error1:
kfree(new);
return ret;
}

Expand Down

0 comments on commit bd637f6

Please sign in to comment.