Skip to content

Commit 6b238de

Browse files
Sebastian Siewiorrichardweinberger
authored andcommitted
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: <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 1a31b20 commit 6b238de

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/mtd/ubi/wl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,7 @@ static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk)
10601060
/* Re-schedule the LEB for erasure */
10611061
err1 = schedule_erase(ubi, e, vol_id, lnum, 0);
10621062
if (err1) {
1063+
wl_entry_destroy(ubi, e);
10631064
err = err1;
10641065
goto out_ro;
10651066
}

0 commit comments

Comments
 (0)