summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2019-07-15 12:28:26 +0200
committerKarel Zak2019-07-15 12:28:26 +0200
commit9e677de1ecbb5c724f679e66d773494e370db97f (patch)
tree7ebc7ce12e9ba43ea1f68f019b4fecfc22433edd
parentlibblkid: (drbd) simplify padding (diff)
downloadkernel-qcow2-util-linux-9e677de1ecbb5c724f679e66d773494e370db97f.tar.gz
kernel-qcow2-util-linux-9e677de1ecbb5c724f679e66d773494e370db97f.tar.xz
kernel-qcow2-util-linux-9e677de1ecbb5c724f679e66d773494e370db97f.zip
lsblk: fix -E segfault
We need to check if referenced wholedisk defines the de-duplication key... Addresses: https://github.com/karelzak/util-linux/issues/819 Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--misc-utils/lsblk-devtree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/misc-utils/lsblk-devtree.c b/misc-utils/lsblk-devtree.c
index a2aa26aed..4d15f70c1 100644
--- a/misc-utils/lsblk-devtree.c
+++ b/misc-utils/lsblk-devtree.c
@@ -384,6 +384,7 @@ static int device_dedupkey_is_equal(
return 0;
if (strcmp(dev->dedupkey, pattern->dedupkey) == 0) {
if (!device_is_partition(dev) ||
+ !dev->wholedisk->dedupkey ||
strcmp(dev->dedupkey, dev->wholedisk->dedupkey) != 0) {
DBG(DEV, ul_debugobj(dev, "%s: match deduplication pattern", dev->name));
return 1;
@@ -458,6 +459,7 @@ int lsblk_devtree_deduplicate_devices(struct lsblk_devtree *tr)
if (!pattern->dedupkey)
continue;
if (device_is_partition(pattern) &&
+ pattern->wholedisk->dedupkey &&
strcmp(pattern->dedupkey, pattern->wholedisk->dedupkey) == 0)
continue;
if (last && strcmp(pattern->dedupkey, last) == 0)