Skip to content

Commit 4b3e0a2

Browse files
richardweinbergerdedekind
authored andcommitted
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>
1 parent f240dca commit 4b3e0a2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎drivers/mtd/ubi/attach.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,9 +1417,11 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
14171417
ai = alloc_ai("ubi_aeb_slab_cache2");
14181418
if (!ai)
14191419
return -ENOMEM;
1420-
}
14211420

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+
}
14231425
}
14241426
}
14251427
#else

0 commit comments

Comments
 (0)