cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

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

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