aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2013-09-28 09:55:12 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-10-03 12:42:49 -0400
commit4b3e0a25aa5518892ec8dbfafdd6a57789aa0c22 (patch)
tree0b6df0a177414b11d618a4aca390a192bca5f247 /drivers/mtd/ubi
parentf240dca8f2fdf11d52a7bacd867e274c3b21a7d3 (diff)
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 <richard.genoud@gmail.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/attach.c6
1 files changed, 4 insertions, 2 deletions
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)
1417 ai = alloc_ai("ubi_aeb_slab_cache2"); 1417 ai = alloc_ai("ubi_aeb_slab_cache2");
1418 if (!ai) 1418 if (!ai)
1419 return -ENOMEM; 1419 return -ENOMEM;
1420 }
1421 1420
1422 err = scan_all(ubi, ai, UBI_FM_MAX_START); 1421 err = scan_all(ubi, ai, 0);
1422 } else {
1423 err = scan_all(ubi, ai, UBI_FM_MAX_START);
1424 }
1423 } 1425 }
1424 } 1426 }
1425#else 1427#else