[PATCH 6/6] hfs: stop at the first matching entry of the old partition map
From: Viacheslav Dubeyko
Date: Fri Dec 04 2026 - 20:32:06 EST
When hfs_part_find() finds a matching "TFS1" entry in the old partition
map, it adds the start of the partition to *part_start and sets
*part_size, but it doesn't leave the loop. It goes on checking the rest
of the 42 entries, so without the part= mount option every following
"TFS1" entry adds its start to *part_start again. As a result, the MDB is
looked for at the sum of the partition starts, which is not the start of
any partition, and the size of the last entry is used with it. Also,
hfs_part_valid() checks the following entries against the already
shifted *part_start.
The new partition map branch of hfs_part_find() and the hfsplus code
stop at the first matching entry. Do the same for the old partition map.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Viacheslav Dubeyko <slava@xxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
cc: John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx>
cc: Yangtao Li <frank.li@xxxxxxxx>
cc: linux-fsdevel@xxxxxxxxxxxxxxx
---
fs/hfs/part_tbl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/hfs/part_tbl.c b/fs/hfs/part_tbl.c
index 05c4c360bd68..5764e282b779 100644
--- a/fs/hfs/part_tbl.c
+++ b/fs/hfs/part_tbl.c
@@ -117,6 +117,7 @@ int hfs_part_find(struct super_block *sb,
*part_start += entry_start;
*part_size = entry_count;
res = 0;
+ break;
}
}
break;
--
2.53.0