[dm-devel] [PATCH] libmultipath: call udev_device_unref before return

lixiaokeng lixiaokeng at huawei.com
Thu Oct 22 07:30:13 UTC 2020


There is a bug in commit acff7d4. Before return, we should call
udev_device_unref(hostdev) in sysfs_get_tgt_nodenam.

Signed-off_by:lixiaokeng <lxiiaokeng at huawei.com>
---
 libmultipath/discovery.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 193d7127..c2e1754c 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -518,8 +518,10 @@ int sysfs_get_host_pci_name(const struct path *pp, char *pci_name)
 		 */
 		value = udev_device_get_sysname(parent);

-		if (!value)
+		if (!value) {
+			udev_device_unref(hostdev);
 			return 1;
+		}

 		strncpy(pci_name, value, SLOT_NAME_SIZE);
 		udev_device_unref(hostdev);
-- 




More information about the dm-devel mailing list