[PATCH v4 12/12] multipathd: fix use-after-free in handle_path_wwid_change()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Martin Wilck <mwilck@xxxxxxxx>

Found by coverity (defect #380536).

Fixes: b4eb57e ("libmultipath, multipathd: log failure setting sysfs attributes")
---
 multipathd/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index 66177cd..2d0a7bc 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -951,10 +951,12 @@ handle_path_wwid_change(struct path *pp, struct vectors *vecs)
 	struct udev_device *udd;
 	static const char add[] = "add";
 	ssize_t ret;
+	char dev[FILE_NAME_SIZE];
 
 	if (!pp || !pp->udev)
 		return;
 
+	strlcpy(dev, pp->dev, sizeof(dev));
 	udd = udev_device_ref(pp->udev);
 	if (!(ev_remove_path(pp, vecs, 1) & REMOVE_PATH_SUCCESS) && pp->mpp) {
 		pp->dmstate = PSTATE_FAILED;
@@ -965,8 +967,7 @@ handle_path_wwid_change(struct path *pp, struct vectors *vecs)
 	udev_device_unref(udd);
 	if (ret != sizeof(add) - 1)
 		log_sysfs_attr_set_value(1, ret,
-					 "%s: failed to trigger add event",
-					 pp->dev);
+					 "%s: failed to trigger add event", dev);
 }
 
 bool
-- 
2.37.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux