Skip to contentSkip to conversation

libmultipath: call udev_device_unref before return

PATCH In review lixiaokeng 2 participants 2 messages Oct 22, 2020 – Nov 1, 2020 Device mapper

lore
Share & tools
lore

lixiaokeng

author
#0 lore raw

PATCH 1/1 libmultipath: call udev_device_unref before return

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 <[email protected]>

---
 libmultipath/discovery.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
libmultipath/discovery.c +3 -1
index 193d7127..c2e1754c 100644
@@ -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);
Signature · 4 lines
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · lixiaokeng

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 <[email protected]>

Quoted 20 lines
---
 libmultipath/discovery.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
libmultipath/discovery.c +3 -1
index 193d7127..c2e1754c 100644
@@ -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);
Quoted 1 line

udev_device_unref(hostdev);

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel