]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: make minix prober more robust
authorKarel Zak <kzak@redhat.com>
Mon, 18 Jan 2016 13:35:33 +0000 (14:35 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Jan 2016 13:47:40 +0000 (14:47 +0100)
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>
libblkid/src/superblocks/minix.c

index d6d45bd9b767e9bbf1697b3f4c39a79d696fef92..cb8b84f3a329100d8fa2e560ad5fb6002c96a5b9 100644 (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;