aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-10-02 14:10:46 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2023-10-02 14:10:46 -0700
commitce36c8b149873b50f2a4b9818eb3dcdd74ddd5a3 (patch)
tree87c43c3ca6543ec60ad421325d001dbb14028fa7
parenta9c2be4f3730961fdda03d226d783e444babe6f2 (diff)
parent017c73a34a661a861712f7cc1393a123e5b2208c (diff)
downloadlinux-ce36c8b149873b50f2a4b9818eb3dcdd74ddd5a3.tar.gz
Merge tag 'ubifs-for-linus-6.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs
Pull UBI fix from Richard Weinberger: - Don't try to attach MTDs with erase block size 0 * tag 'ubifs-for-linus-6.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs: ubi: Refuse attaching if mtd's erasesize is 0
-rw-r--r--drivers/mtd/ubi/build.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 8b91a55ec0d288..8ee51e49fced55 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -894,6 +894,13 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
return -EINVAL;
}
+ /* UBI cannot work on flashes with zero erasesize. */
+ if (!mtd->erasesize) {
+ pr_err("ubi: refuse attaching mtd%d - zero erasesize flash 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++)