* [PATCH] multipath: fix libudev bug in sysfs_get_tgt_nodename
@ 2012-06-11 21:32 Benjamin Marzinski
0 siblings, 0 replies; only message in thread
From: Benjamin Marzinski @ 2012-06-11 21:32 UTC (permalink / raw)
To: device-mapper development
In a recent patch, I introduced a bug into sysfs_get_tgt_nodename().
multipath must not unreference the target udevice before it copies the
tgt_nodename to another location, otherwise the value pointer will be
pointing at freed memory.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Index: multipath-tools-120518/libmultipath/discovery.c
===================================================================
--- multipath-tools-120518.orig/libmultipath/discovery.c
+++ multipath-tools-120518/libmultipath/discovery.c
@@ -215,11 +215,13 @@ sysfs_get_tgt_nodename (struct path *pp,
const char *value;
value = udev_device_get_sysattr_value(tgtdev, "node_name");
- udev_device_unref(tgtdev);
if (value) {
strncpy(node, value, NODE_NAME_SIZE);
+ udev_device_unref(tgtdev);
return 0;
}
+ else
+ udev_device_unref(tgtdev);
}
/* Check for iSCSI */
@@ -238,11 +240,13 @@ sysfs_get_tgt_nodename (struct path *pp,
const char *value;
value = udev_device_get_sysattr_value(tgtdev, "targetname");
- udev_device_unref(tgtdev);
if (value) {
strncpy(node, value, NODE_NAME_SIZE);
+ udev_device_unref(tgtdev);
return 0;
}
+ else
+ udev_device_unref(tgtdev);
}
}
return 1;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-06-11 21:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-11 21:32 [PATCH] multipath: fix libudev bug in sysfs_get_tgt_nodename Benjamin Marzinski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.