mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
ubi: Reject MLC NAND
While UBI and UBIFS seem to work at first sight with MLC NAND, you will most likely lose all your data upon a power-cut or due to read/write disturb. In order to protect users from bad surprises, refuse to attach to MLC NAND. Cc: [email protected] Signed-off-by: Richard Weinberger <[email protected]> Acked-by: Boris Brezillon <[email protected]> Acked-by: Artem Bityutskiy <[email protected]>
This commit is contained in:
parent
4fb1cd8230
commit
b5094b7f13
1 changed files with 11 additions and 0 deletions
|
|
@ -854,6 +854,17 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Both UBI and UBIFS have been designed for SLC NAND and NOR flashes.
|
||||
* MLC NAND is different and needs special care, otherwise UBI or UBIFS
|
||||
* will die soon and you will lose all your data.
|
||||
*/
|
||||
if (mtd->type == MTD_MLCNANDFLASH) {
|
||||
pr_err("ubi: refuse attaching mtd%d - MLC NAND is not supported\n",
|
||||
mtd->index);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ubi_num == UBI_DEV_NUM_AUTO) {
|
||||
/* Search for an empty slot in the @ubi_devices array */
|
||||
for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++)
|
||||
|
|
|
|||
Loading…
Reference in a new issue