UBI: Fix PEB leak in wear_leveling_worker()
authorRichard Weinberger <richard@nod.at>
Mon, 19 Aug 2013 06:48:12 +0000 (08:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Sep 2013 00:21:35 +0000 (17:21 -0700)
commitadb34ef814140689c6996e511cec807145774ff9
tree68932edbbb28819e664295c01ec7a41d8b15dbe0
parentf81a982fa83db673ab2fa725b1410ee22e8ee4d3
UBI: Fix PEB leak in wear_leveling_worker()

commit 5ef4414f4bc26a19cfd5cd11aee9697a863e4d51 upstream.

get_peb_for_wl() removes the PEB from the free list.
If the WL subsystem detects that no wear leveling is needed
it cancels the operation and drops the gained PEB.
In this case we have to put the PEB back into the free list.

This issue was introduced with commit ed4b7021c
(UBI: remove PEB from free tree in get_peb_for_wl()).

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/wl.c