mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 17:51:57 +09:00
UBI: Fix PEB leak in wear_leveling_worker()
commit5ef4414f4bupstream. 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 commited4b7021c(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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e62b0f0196
commit
e7d63334e7
@@ -1069,6 +1069,9 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
|
||||
if (!(e2->ec - e1->ec >= UBI_WL_THRESHOLD)) {
|
||||
dbg_wl("no WL needed: min used EC %d, max free EC %d",
|
||||
e1->ec, e2->ec);
|
||||
|
||||
/* Give the unused PEB back */
|
||||
wl_tree_add(e2, &ubi->free);
|
||||
goto out_cancel;
|
||||
}
|
||||
self_check_in_wl_tree(ubi, e1, &ubi->used);
|
||||
|
||||
Reference in New Issue
Block a user