UBI: fix error handling in ubi_scan()
commitab053f76fec843ab4db48390319de701d654e9a1
authorRichard Weinberger <richard@nod.at>
Mon, 30 Jan 2012 17:20:13 +0000 (30 18:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Apr 2012 16:52:51 +0000 (2 09:52 -0700)
tree808852f398c738300a0bae58dc9d7e6c0935c2c1
parent81555664cb1238f44c7363061d1a48f0761b2dd8
UBI: fix error handling in ubi_scan()

commit a29852be492d61001d86c6ebf5fff9b93d7b4be9 upstream.

Two bad things can happen in ubi_scan():
1. If kmem_cache_create() fails we jump to out_si and call
   ubi_scan_destroy_si() which calls kmem_cache_destroy().
   But si->scan_leb_slab is NULL.
2. If process_eb() fails we jump to out_vidh, call
   kmem_cache_destroy() and ubi_scan_destroy_si() which calls
   again kmem_cache_destroy().

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/ubi/scan.c