From: Karel Zak Date: Mon, 18 Jan 2016 13:35:33 +0000 (+0100) Subject: libblkid: make minix prober more robust X-Git-Tag: v2.28-rc1~191 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7675d69d017830cfd9d131e8d49e633b6dd535bb;p=thirdparty%2Futil-linux.git 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 --- diff --git a/libblkid/src/superblocks/minix.c b/libblkid/src/superblocks/minix.c index d6d45bd9b7..cb8b84f3a3 100644 --- a/libblkid/src/superblocks/minix.c +++ b/libblkid/src/superblocks/minix.c @@ -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;