File bug-1164718_25-devs-check-for-no-dev-when-dropping-aliases.patch of Package device-mapper.18094

From f50af80199f723f7b1970ee33ddf959ea79fcbef Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 16 Oct 2019 13:32:28 -0500
Subject: [PATCH] devs: check for no dev when dropping aliases

When scanning fails to find a device path and
looks for device aliases, check if the device
itself still exists to avoid a potential segfault.
---
 lib/label/label.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/label/label.c b/lib/label/label.c
index 8107e33f7..e4a106854 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -734,6 +734,11 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
 		retried_open = 1;
 
 		dm_list_iterate_items_safe(devl, devl2, &reopen_devs) {
+			if (!devl->dev) {
+				dm_list_del(&devl->list);
+				continue;
+			}
+
 			_drop_bad_aliases(devl->dev);
 
 			if (dm_list_empty(&devl->dev->aliases)) {
-- 
2.24.0

openSUSE Build Service is sponsored by