summaryrefslogtreecommitdiff
path: root/lib/label/hints.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2022-02-22 15:03:11 -0600
committerDavid Teigland <teigland@redhat.com>2022-02-24 15:37:53 -0600
commit07338325e552bb692f2422f42750e70c9d31152c (patch)
tree46016e2027141fa85b7e5aae58c1ce6c14bb41b3 /lib/label/hints.c
parentac1f4bbbfd4c5f1387c3e0607f7d556409e7a4b4 (diff)
downloadlvm2-dev-dct-devs3.tar.gz
devices: fix name handlingdev-dct-devs3
- Fix cases where incorrect device paths were left on the dev->aliases list. Leaving incorrect paths on dev->aliases could result in using the wrong device. - Fix a widespread incorrect assumption that dev_name() always returns a valid path (or NULL). dev_name() returns "[unknown]" when there are no paths to a device, and is mainly meant to be used in messages. - Check for valid dev paths in cases that want to use the from dev_name() for things other than a message.
Diffstat (limited to 'lib/label/hints.c')
-rw-r--r--lib/label/hints.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/label/hints.c b/lib/label/hints.c
index 35ae7f5cc..edce6f517 100644
--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -500,6 +500,8 @@ int validate_hints(struct cmd_context *cmd, struct dm_list *hints)
if (!(iter = dev_iter_create(NULL, 0)))
return 0;
while ((dev = dev_iter_get(cmd, iter))) {
+ if (dm_list_empty(&dev->aliases))
+ continue;
if (!(hint = _find_hint_name(hints, dev_name(dev))))
continue;