From 5a6e56ec1703e84f7860152e483da816ca4b1cbb Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 7 Apr 2021 22:36:12 +0900 Subject: [PATCH] udev: fix potential infinite loop --- src/udev/udev-builtin-net_id.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index f4b200ea423..f84c2669a85 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -395,8 +395,9 @@ static int dev_pci_slot(sd_device *dev, struct netnames *names) { break; } - if (sd_device_get_sysname(hotplug_slot_dev, &sysname) < 0) - continue; + r = sd_device_get_sysname(hotplug_slot_dev, &sysname); + if (r < 0) + return log_device_debug_errno(hotplug_slot_dev, r, "Failed to get sysname: %m"); FOREACH_DIRENT_ALL(dent, dir, break) { _cleanup_free_ char *address = NULL;