[PATCH] dos-partitions: Fix extended partitions

Sascha Hauer s.hauer at pengutronix.de
Tue Jan 25 02:41:40 PST 2022

extended partitions are currently registered with their full size which
means they overlap with the logical partitions therein. Since 7f9f45b9bf
("devfs: Do not create overlapping partitions") we no longer register
overlapping partitions, so the logical partitions are no longer
accessible. Fix this by reducing the size of the extended partition to
two blocks (1kiB) which is the same as Linux does.

Fixes: 7f9f45b9bf ("devfs: Do not create overlapping partitions")
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
Reported-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
 common/partitions/dos.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/partitions/dos.c b/common/partitions/dos.c
index 6c76aac371..597d7bf9bc 100644
--- a/common/partitions/dos.c
+++ b/common/partitions/dos.c
@@ -200,6 +200,8 @@ static void dos_partition(void *buf, struct block_device *blk,
 			if (is_extended_partition(&pentry)) {
+				pd->parts[n].size = 2;
 				if (!extended_partition)
 					extended_partition = &pd->parts[n];

More information about the barebox mailing list