ubi: fastmap: Erase outdated anchor PEBs during attach
authorSascha Hauer <s.hauer@pengutronix.de>
Tue, 5 Dec 2017 15:01:20 +0000 (16:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Feb 2018 19:22:57 +0000 (20:22 +0100)
commit5793f39de7f64938c23cc062b1e170505789b0b0
treee4d6bf631ab12a0195846be01fe0c4cd6f559e0c
parentc94c39ac85f11698f3f0babb515f79656df3917e
ubi: fastmap: Erase outdated anchor PEBs during attach

commit f78e5623f45bab2b726eec29dc5cefbbab2d0b1c upstream.

The fastmap update code might erase the current fastmap anchor PEB
in case it doesn't find any new free PEB. When a power cut happens
in this situation we must not have any outdated fastmap anchor PEB
on the device, because that would be used to attach during next
boot.
The easiest way to make that sure is to erase all outdated fastmap
anchor PEBs synchronously during attach.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Richard Weinberger <richard@nod.at>
Fixes: dbb7d2a88d2a ("UBI: Add fastmap core")
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/ubi/wl.c