From: Richard Weinberger Date: Sat, 28 Sep 2013 13:55:12 +0000 (+0200) Subject: UBI: Call scan_all() with correct offset in error case X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4b3e0a25aa5518892ec8dbfafdd6a57789aa0c22;p=linux-beck.git UBI: Call scan_all() with correct offset in error case If we find an invalid fastmap we have to scan from the very beginning. Otherwise we leak the first 64 PEBs. Reported-and-tested-by: Richard Genoud Signed-off-by: Richard Weinberger Signed-off-by: Artem Bityutskiy --- diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c index c071d410488f..03b32b05ab15 100644 --- a/drivers/mtd/ubi/attach.c +++ b/drivers/mtd/ubi/attach.c @@ -1417,9 +1417,11 @@ int ubi_attach(struct ubi_device *ubi, int force_scan) ai = alloc_ai("ubi_aeb_slab_cache2"); if (!ai) return -ENOMEM; - } - err = scan_all(ubi, ai, UBI_FM_MAX_START); + err = scan_all(ubi, ai, 0); + } else { + err = scan_all(ubi, ai, UBI_FM_MAX_START); + } } } #else