Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56248b49 authored by Sebastian Siewior's avatar Sebastian Siewior Committed by Nikhilesh Reddy
Browse files

mtd: ubi: fixup error correction in do_sync_erase()



Since fastmap we gained do_sync_erase(). This function can return an error
and its error handling isn't obvious. First the memory allocation for
struct ubi_work can fail and as such struct ubi_wl_entry is leaked.
However if the memory allocation succeeds then the tail function takes
care of the struct ubi_wl_entry. A free here could result in a double
free.
To make the error handling simpler, I split the tail function into one
piece which does the work and another which frees the struct ubi_work
which is passed as argument. As result do_sync_erase() can keep the
struct on stack and we get rid of one error source.

CRs-Fixed: 975289
Change-Id: Ie584b80b4e2c9efa63e2cfb0df79598df50b17e2
Cc: <stable@vger.kernel.org>
Fixes: 8199b901 ("UBI: Add fastmap support to the WL sub-system")
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Git-commit: 1a31b20cd81d5cbc7ec6e24cb08066009a1ca32d
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarNikhilesh Reddy <reddyn@codeaurora.org>
parent bb1355ed
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment