Blame SOURCES/0151-libblkid-minix-Sanity-check-superblock-s_state-for-v.patch

e42290
From 289f0cd75f168f86702913658ebe2dbfd8e987c6 Mon Sep 17 00:00:00 2001
e42290
From: Nate Clark <nate@neworld.us>
e42290
Date: Wed, 4 Jan 2017 15:21:17 -0500
e42290
Subject: [PATCH 151/152] libblkid/minix: Sanity check superblock s_state for v
e42290
 1 and 2
e42290
e42290
Swap devices with specific values in the uuid can look like minix
e42290
devices to blkid. Add an extra check to make sure the state of the
e42290
filesystem has valid state flags.
e42290
e42290
A couple of offending swap uuids include:
e42290
35f1f264-137f-471a-bc85-acc9f4bc04a3
e42290
35f1f264-7f13-471a-bc85-acc9f4bc04a3
e42290
35f1f264-138f-471a-bc85-acc9f4bc04a3
e42290
35f1f264-8f13-471a-bc85-acc9f4bc04a3
e42290
e42290
Without this change a swap device with any of those uuids would be
e42290
detected as minix and swap by blkid.
e42290
e42290
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1594681
e42290
Upstream: http://github.com/karelzak/util-linux/commit/892553b1a41b449f58462f123eca2bf2c6c56b33
e42290
Signed-off-by: Nate Clark <nate@neworld.us>
e42290
---
e42290
 libblkid/src/superblocks/minix.c | 4 ++++
e42290
 1 file changed, 4 insertions(+)
e42290
e42290
diff --git a/libblkid/src/superblocks/minix.c b/libblkid/src/superblocks/minix.c
e42290
index a20d51f2c..4e70fda8f 100644
e42290
--- a/libblkid/src/superblocks/minix.c
e42290
+++ b/libblkid/src/superblocks/minix.c
e42290
@@ -93,6 +93,10 @@ static int probe_minix(blkid_probe pr, const struct blkid_idmag *mag)
e42290
 		if (sb->s_imap_blocks == 0 || sb->s_zmap_blocks == 0)
e42290
 			return 1;
e42290
 
e42290
+		uint16_t state = minix_swab16(swabme, sb->s_state);
e42290
+		if ((state & (MINIX_VALID_FS | MINIX_ERROR_FS)) != state)
e42290
+			return 1;
e42290
+
e42290
 		zones = version == 2 ? minix_swab32(swabme, sb->s_zones) :
e42290
 				       minix_swab16(swabme, sb->s_nzones);
e42290
 		ninodes = minix_swab16(swabme, sb->s_ninodes);
e42290
-- 
e42290
2.14.4
e42290