aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/hack-5.10
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2022-01-11 00:00:36 +0000
committerDaniel Golle <daniel@makrotopia.org>2022-01-11 00:06:16 +0000
commitf2c3875dfcbf82d993ebe20f9563125c5fde2c60 (patch)
treea5e0bef99224f2bd994de33376e206d48b97d9ea /target/linux/generic/hack-5.10
parent8cdc356f8c30b55698d5f57abbd1f3e16d8c653e (diff)
downloadupstream-f2c3875dfcbf82d993ebe20f9563125c5fde2c60.tar.gz
upstream-f2c3875dfcbf82d993ebe20f9563125c5fde2c60.tar.bz2
upstream-f2c3875dfcbf82d993ebe20f9563125c5fde2c60.zip
generic: deny write to uImage.FIT sub-image partitions
Set policy bit to force read-only mode on uImage.FIT filesystem sub-images mapped as block partitions by the FIT partition parser. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target/linux/generic/hack-5.10')
-rw-r--r--target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch10
1 files changed, 7 insertions, 3 deletions
diff --git a/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch b/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch
index c0b3c25339..bc48296d9c 100644
--- a/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch
+++ b/target/linux/generic/hack-5.10/410-block-fit-partition-parser.patch
@@ -1,10 +1,11 @@
--- a/block/blk.h
+++ b/block/blk.h
-@@ -361,6 +361,7 @@ char *disk_name(struct gendisk *hd, int
+@@ -361,6 +361,8 @@ char *disk_name(struct gendisk *hd, int
#define ADDPART_FLAG_NONE 0
#define ADDPART_FLAG_RAID 1
#define ADDPART_FLAG_WHOLEDISK 2
-+#define ADDPART_FLAG_ROOTDEV 4
++#define ADDPART_FLAG_READONLY 4
++#define ADDPART_FLAG_ROOTDEV 8
void delete_partition(struct hd_struct *part);
int bdev_add_partition(struct block_device *bdev, int partno,
sector_t start, sector_t length);
@@ -73,13 +74,16 @@
#ifdef CONFIG_SGI_PARTITION
sgi_partition,
#endif
-@@ -694,6 +701,11 @@ static bool blk_add_partition(struct gen
+@@ -694,6 +701,14 @@ static bool blk_add_partition(struct gen
(state->parts[p].flags & ADDPART_FLAG_RAID))
md_autodetect_dev(part_to_dev(part)->devt);
+#ifdef CONFIG_FIT_PARTITION
+ if ((state->parts[p].flags & ADDPART_FLAG_ROOTDEV) && ROOT_DEV == 0)
+ ROOT_DEV = part_to_dev(part)->devt;
++
++ if (state->parts[p].flags & ADDPART_FLAG_READONLY)
++ part->policy = true;
+#endif
+
return true;