]> git.baikalelectronics.ru Git - kernel.git/commit
ubi: Fix races around ubi_refill_pools()
authorRichard Weinberger <richard@nod.at>
Wed, 24 Aug 2016 12:36:14 +0000 (14:36 +0200)
committerRichard Weinberger <richard@nod.at>
Sun, 2 Oct 2016 20:54:01 +0000 (22:54 +0200)
commit561e9791b2c4af0f6368040f6d85de311ec12602
tree978c8095e114898a898df44014996611a39ddfef
parentca7c3dc52377f36187b77975a084d844eb6541e4
ubi: Fix races around ubi_refill_pools()

When writing a new Fastmap the first thing that happens
is refilling the pools in memory.
At this stage it is possible that new PEBs from the new pools
get already claimed and written with data.
If this happens before the new Fastmap data structure hits the
flash and we face power cut the freshly written PEB will not
scanned and unnoticed.

Solve the issue by locking the pools until Fastmap is written.

Cc: <stable@vger.kernel.org>
Fixes: 84a12fae96 ("UBI: Add fastmap core")
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/eba.c
drivers/mtd/ubi/fastmap-wl.c
drivers/mtd/ubi/fastmap.c
drivers/mtd/ubi/wl.c