diff options
author | Nate Clark | 2017-01-04 21:21:17 +0100 |
---|---|---|
committer | Nate Clark | 2017-01-04 21:24:40 +0100 |
commit | 892553b1a41b449f58462f123eca2bf2c6c56b33 (patch) | |
tree | ff8b7ccdae4f8435a10eb7da50eab233a724583f /libblkid/src/superblocks | |
parent | libblkid/minix: Use same checks for version 3 (diff) | |
download | kernel-qcow2-util-linux-892553b1a41b449f58462f123eca2bf2c6c56b33.tar.gz kernel-qcow2-util-linux-892553b1a41b449f58462f123eca2bf2c6c56b33.tar.xz kernel-qcow2-util-linux-892553b1a41b449f58462f123eca2bf2c6c56b33.zip |
libblkid/minix: Sanity check superblock s_state for v 1 and 2
Swap devices with specific values in the uuid can look like minix
devices to blkid. Add an extra check to make sure the state of the
filesystem has valid state flags.
A couple of offending swap uuids include:
35f1f264-137f-471a-bc85-acc9f4bc04a3
35f1f264-7f13-471a-bc85-acc9f4bc04a3
35f1f264-138f-471a-bc85-acc9f4bc04a3
35f1f264-8f13-471a-bc85-acc9f4bc04a3
Without this change a swap device with any of those uuids would be
detected as minix and swap by blkid.
Signed-off-by: Nate Clark <nate@neworld.us>
Diffstat (limited to 'libblkid/src/superblocks')
-rw-r--r-- | libblkid/src/superblocks/minix.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libblkid/src/superblocks/minix.c b/libblkid/src/superblocks/minix.c index 3e126e0ea..feebc96ad 100644 --- a/libblkid/src/superblocks/minix.c +++ b/libblkid/src/superblocks/minix.c @@ -94,6 +94,10 @@ static int probe_minix(blkid_probe pr, if (version <= 2) { struct minix_super_block *sb = (struct minix_super_block *) data; + uint16_t state = minix_swab16(swabme, sb->s_state); + if ((state & (MINIX_VALID_FS | MINIX_ERROR_FS)) != state) + return 1; + zones = version == 2 ? minix_swab32(swabme, sb->s_zones) : minix_swab16(swabme, sb->s_nzones); ninodes = minix_swab16(swabme, sb->s_ninodes); |