patch 'bus/vmbus: fix leak on device scan' has been queued to stable release 19.11.11

christian.ehrhardt at canonical.com christian.ehrhardt at canonical.com
Tue Nov 30 17:34:18 CET 2021


Hi,

FYI, your patch has been queued to stable release 19.11.11

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before December 10th 2021. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/cpaelzer/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/6586da24bfb3532a87e657276b1906221e3f8d82

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From 6586da24bfb3532a87e657276b1906221e3f8d82 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Sat, 2 Oct 2021 18:24:30 +0200
Subject: [PATCH] bus/vmbus: fix leak on device scan

[ upstream commit c6c865d7e2e47a3a1a65a091103cca056bb073ef ]

Caught running ASAN.
The device name was leaked on scan.
rte_device name field being a const, use a local pointer and release
in error path.

Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Long Li <longli at microsoft.com>
---
 drivers/bus/vmbus/linux/vmbus_bus.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index 3c924eee14..68f6cc5742 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -236,13 +236,14 @@ vmbus_scan_one(const char *name)
 	char filename[PATH_MAX];
 	char dirname[PATH_MAX];
 	unsigned long tmp;
+	char *dev_name;
 
 	dev = calloc(1, sizeof(*dev));
 	if (dev == NULL)
 		return -1;
 
 	dev->device.bus = &rte_vmbus_bus.bus;
-	dev->device.name = strdup(name);
+	dev->device.name = dev_name = strdup(name);
 	if (!dev->device.name)
 		goto error;
 
@@ -261,6 +262,7 @@ vmbus_scan_one(const char *name)
 
 	/* skip non-network devices */
 	if (rte_uuid_compare(dev->class_id, vmbus_nic_uuid) != 0) {
+		free(dev_name);
 		free(dev);
 		return 0;
 	}
@@ -312,6 +314,7 @@ vmbus_scan_one(const char *name)
 		} else { /* already registered */
 			VMBUS_LOG(NOTICE,
 				"%s already registered", name);
+			free(dev_name);
 			free(dev);
 		}
 		return 0;
@@ -322,6 +325,7 @@ vmbus_scan_one(const char *name)
 error:
 	VMBUS_LOG(DEBUG, "failed");
 
+	free(dev_name);
 	free(dev);
 	return -1;
 }
-- 
2.34.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-30 16:50:09.190949134 +0100
+++ 0054-bus-vmbus-fix-leak-on-device-scan.patch	2021-11-30 16:50:05.706872913 +0100
@@ -1 +1 @@
-From c6c865d7e2e47a3a1a65a091103cca056bb073ef Mon Sep 17 00:00:00 2001
+From 6586da24bfb3532a87e657276b1906221e3f8d82 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit c6c865d7e2e47a3a1a65a091103cca056bb073ef ]
+
@@ -12 +13,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list