android_kernel_oneplus_msm8998/drivers/mtd/ubi
Richard Weinberger 7cff31473f ubi: fastmap: Cancel work upon detach
commit 6e7d80161066c99d12580d1b985cb1408bb58cf1 upstream.

Ben Hutchings pointed out that 29b7a6fa1ec0 ("ubi: fastmap: Don't flush
fastmap work on detach") does not really fix the problem, it just
reduces the risk to hit the race window where fastmap work races against
free()'ing ubi->volumes[].

The correct approach is making sure that no more fastmap work is in
progress before we free ubi data structures.
So we cancel fastmap work right after the ubi background thread is
stopped.
By setting ubi->thread_enabled to zero we make sure that no further work
tries to wake the thread.

Fixes: 29b7a6fa1ec0 ("ubi: fastmap: Don't flush fastmap work on detach")
Fixes: 74cdaf2400 ("UBI: Fastmap: Fix memory leaks while closing the WL sub-system")
Cc: stable@vger.kernel.org
Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Martin Townsend <mtownsend1973@gmail.com>

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-03 11:21:32 +02:00
..
attach.c UBI: drop null test before destroy functions 2015-10-03 20:36:10 +02:00
block.c ubi: Fix error for write access 2018-04-24 09:32:05 +02:00
build.c ubi: fastmap: Cancel work upon detach 2018-07-03 11:21:32 +02:00
cdev.c UBI: Remove in vain semicolon 2015-11-06 23:26:51 +01:00
debug.c UBI: fix return error code 2015-12-16 22:45:04 +01:00
debug.h UBI: power cut emulation for testing 2015-04-13 21:05:17 +02:00
eba.c ubi: Make recover_peb power cut aware 2016-07-27 09:47:33 -07:00
fastmap-wl.c ubi: fastmap: Don't flush fastmap work on detach 2018-04-24 09:32:05 +02:00
fastmap.c ubi: fastmap: Fix add_vol() return value test in ubi_attach_fastmap() 2016-11-10 16:36:37 +01:00
gluebi.c UBI: Update comments to reflect UBI_METAONLY flag 2015-10-03 20:11:59 +02:00
io.c UBI: fix use of "VID" vs. "EC" in header self-check 2015-12-16 22:46:26 +01:00
kapi.c VFS: assorted d_backing_inode() annotations 2015-04-15 15:06:59 -04:00
Kconfig UBI: block: Add CONFIG_BLOCK dependency 2014-03-04 14:49:53 +02:00
Makefile UBI: R/O block driver on top of UBI volumes 2014-02-28 16:29:48 +02:00
misc.c UBI: fix soft lockup in ubi_check_volume() 2015-01-28 16:18:09 +01:00
ubi-media.h UBI: Fix typo in comment 2015-10-03 20:09:41 +02:00
ubi.h UBI: Fix static volume checks when Fastmap is used 2016-06-01 12:15:54 -07:00
upd.c ubi/upd: Always flush after prepared for an update 2017-04-27 09:09:33 +02:00
vmt.c ubi: Fix race condition between ubi volume creation and udev 2018-03-18 11:17:52 +01:00
vtbl.c UBI: return ENOSPC if no enough space available 2015-09-29 12:47:05 +02:00
wl.c ubi: fastmap: Cancel work upon detach 2018-07-03 11:21:32 +02:00
wl.h UBI: Fastmap: Remove is_fm_block() 2015-03-26 22:47:38 +01:00