libblkid: make minix prober more robust

It seems that the current minix probing code is not robust enough and
it returns false positive for Fedora f24 install images. The crazy thing
is that the image pass also all Linux kernel minix_fill_super() checks
and mount(2) fails later when it tries to read filesystem root
directory.

The fsck.minix requires sb->s_log_zone_size to be zero (Linux kernel
does not care about it), let's use the same requirement for libblkid.

Note, it would be possible to check minix root directory inode in
libblkid, but this solution requires minix prober specific seek &
read. We want to avoid extra read operations...

References: https://bugzilla.redhat.com/show_bug.cgi?id=1299255
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2016-01-18 14:35:33 +01:00
parent 8afabdb1fa
commit 7675d69d01
1 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,8 @@ static int probe_minix(blkid_probe pr, const struct blkid_idmag *mag)
struct minix_super_block *sb = (struct minix_super_block *) data;
int zones, ninodes, imaps, zmaps, firstz;
if (sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0)
if (sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0 ||
sb->s_log_zone_size != 0)
return 1;
zones = version == 2 ? minix_swab32(swabme, sb->s_zones) :
@ -105,7 +106,6 @@ static int probe_minix(blkid_probe pr, const struct blkid_idmag *mag)
return 1;
if (zmaps * MINIX_BLOCK_SIZE * 8 < zones - firstz + 1)
return 1;
} else if (version == 3) {
struct minix3_super_block *sb = (struct minix3_super_block *) data;