[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1539530741.502345812@decadent.org.uk>
Date: Sun, 14 Oct 2018 16:25:41 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, "Richard Weinberger" <richard@....at>,
"Artem Bityutskiy" <dedekind1@...il.com>,
"Boris Brezillon" <boris.brezillon@...tlin.com>
Subject: [PATCH 3.16 102/366] ubi: Reject MLC NAND
3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <richard@....at>
commit b5094b7f135be34630e3ea8a98fa215715d0f29d upstream.
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.
Signed-off-by: Richard Weinberger <richard@....at>
Acked-by: Boris Brezillon <boris.brezillon@...tlin.com>
Acked-by: Artem Bityutskiy <dedekind1@...il.com>
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
drivers/mtd/ubi/build.c | 11 +++++++++++
1 file changed, 11 insertions(+)
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -905,6 +905,17 @@ int ubi_attach_mtd_dev(struct mtd_info *
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++)
Powered by blists - more mailing lists