From 0c707d37b7f767daca655e02558299fe100fd3f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0tetiar?= Date: Tue, 21 Jan 2020 17:05:19 +0100 Subject: [PATCH] Revert "kernel: mtd: Make subpartitions inherit parent's access mode" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This reverts commit de80424f706682e8bba27c60bcd2a9c1b4a5e875 which needs more work and testing as it broke at least jffs2 overlays at least on ath79 platform, marking them as read-only, thus unusable: jffs2_build_filesystem(): erasing all blocks after the end marker... jffs2: Erase at 0x009e0000 failed immediately: -EROFS. Is the sector locked? Ref: http://lists.infradead.org/pipermail/openwrt-devel/2020-January/021344.html Reported-by: Steve Brown Signed-off-by: Petr Å tetiar --- ...inherit-parent-partition-access-mode.patch | 60 ------------------- ...inherit-parent-partition-access-mode.patch | 60 ------------------- 2 files changed, 120 deletions(-) delete mode 100644 target/linux/generic/hack-4.14/401-inherit-parent-partition-access-mode.patch delete mode 100644 target/linux/generic/hack-4.19/401-inherit-parent-partition-access-mode.patch diff --git a/target/linux/generic/hack-4.14/401-inherit-parent-partition-access-mode.patch b/target/linux/generic/hack-4.14/401-inherit-parent-partition-access-mode.patch deleted file mode 100644 index dbbe68ff4a..0000000000 --- a/target/linux/generic/hack-4.14/401-inherit-parent-partition-access-mode.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- a/drivers/mtd/mtdchar.c -+++ b/drivers/mtd/mtdchar.c -@@ -595,7 +595,10 @@ - /* Sanitize user input */ - p.devname[BLKPG_DEVNAMELTH - 1] = '\0'; - -- return mtd_add_partition(mtd, p.devname, p.start, p.length); -+ /* No mtd flags masking required */ -+ uint32_t mask_flags = 0; -+ -+ return mtd_add_partition(mtd, p.devname, p.start, p.length, mask_flags); - - case BLKPG_DEL_PARTITION: - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -726,7 +726,7 @@ - } - - int mtd_add_partition(struct mtd_info *parent, const char *name, -- long long offset, long long length) -+ long long offset, long long length, uint32_t mask_flags) - { - struct mtd_partition part; - struct mtd_part *new; -@@ -747,6 +747,7 @@ - part.name = name; - part.size = length; - part.offset = offset; -+ part.mask_flags = mask_flags; - - new = allocate_partition(parent, &part, -1, offset); - if (IS_ERR(new)) -@@ -855,10 +856,14 @@ - /* adjust partition offsets */ - parts[i].offset += slave->offset; - -+ /* adjust partition mask */ -+ parts[i].mask_flags = !(slave->mtd.flags & MTD_WRITEABLE) ? MTD_WRITEABLE : 0; -+ - mtd_add_partition(slave->parent, - parts[i].name, - parts[i].offset, -- parts[i].size); -+ parts[i].size, -+ parts[i].mask_flags); - } - - kfree(parts); ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -114,7 +114,7 @@ - - int mtd_is_partition(const struct mtd_info *mtd); - int mtd_add_partition(struct mtd_info *master, const char *name, -- long long offset, long long length); -+ long long offset, long long length, uint32_t mask_flags); - int mtd_del_partition(struct mtd_info *master, int partno); - struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd); - uint64_t mtdpart_get_offset(const struct mtd_info *mtd); diff --git a/target/linux/generic/hack-4.19/401-inherit-parent-partition-access-mode.patch b/target/linux/generic/hack-4.19/401-inherit-parent-partition-access-mode.patch deleted file mode 100644 index 61dd0369a6..0000000000 --- a/target/linux/generic/hack-4.19/401-inherit-parent-partition-access-mode.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- a/drivers/mtd/mtdchar.c -+++ b/drivers/mtd/mtdchar.c -@@ -583,7 +583,10 @@ - /* Sanitize user input */ - p.devname[BLKPG_DEVNAMELTH - 1] = '\0'; - -- return mtd_add_partition(mtd, p.devname, p.start, p.length); -+ /* No mtd flags masking required */ -+ uint32_t mask_flags = 0; -+ -+ return mtd_add_partition(mtd, p.devname, p.start, p.length, mask_flags); - - case BLKPG_DEL_PARTITION: - ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -679,7 +679,7 @@ - } - - int mtd_add_partition(struct mtd_info *parent, const char *name, -- long long offset, long long length) -+ long long offset, long long length, uint32_t mask_flags) - { - struct mtd_partition part; - struct mtd_part *new; -@@ -700,6 +700,7 @@ - part.name = name; - part.size = length; - part.offset = offset; -+ part.mask_flags = mask_flags; - - new = allocate_partition(parent, &part, -1, offset); - if (IS_ERR(new)) -@@ -808,10 +809,14 @@ - /* adjust partition offsets */ - parts[i].offset += slave->offset; - -+ /* adjust partition mask */ -+ parts[i].mask_flags = !(slave->mtd.flags & MTD_WRITEABLE) ? MTD_WRITEABLE : 0; -+ - mtd_add_partition(slave->parent, - parts[i].name, - parts[i].offset, -- parts[i].size); -+ parts[i].size, -+ parts[i].mask_flags); - } - - kfree(parts); ---- a/include/linux/mtd/partitions.h -+++ b/include/linux/mtd/partitions.h -@@ -114,7 +114,7 @@ - - int mtd_is_partition(const struct mtd_info *mtd); - int mtd_add_partition(struct mtd_info *master, const char *name, -- long long offset, long long length); -+ long long offset, long long length, uint32_t mask_flags); - int mtd_del_partition(struct mtd_info *master, int partno); - struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd); - uint64_t mtdpart_get_offset(const struct mtd_info *mtd); -- 2.30.2