From: Sebastian Siewior Date: Thu, 26 Nov 2015 20:23:49 +0000 (+0100) Subject: mtd: ubi: don't leak e if schedule_erase() fails X-Git-Tag: v5.15~14521^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b238de189f69dc77d660d4cce62eed15547f4c3;p=platform%2Fkernel%2Flinux-starfive.git mtd: ubi: don't leak e if schedule_erase() fails If __erase_worker() fails to erase the EB and schedule_erase() fails as well to do anything about it then we go RO. But that is not a reason to leak the e argument here. Therefore clean up e. Cc: Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Richard Weinberger --- diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index f73233f..5606563 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -1060,6 +1060,7 @@ static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk) /* Re-schedule the LEB for erasure */ err1 = schedule_erase(ubi, e, vol_id, lnum, 0); if (err1) { + wl_entry_destroy(ubi, e); err = err1; goto out_ro; }