[dpdk-stable] patch 'bus/vmbus: fix leak on device scan' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:29:46 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/a00d38a2e164c755bfb96192c3da52cc7db4d935

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From a00d38a2e164c755bfb96192c3da52cc7db4d935 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
Cc: Xueming Li <xuemingl at nvidia.com>

[ 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.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:06.540125205 +0800
+++ 0102-bus-vmbus-fix-leak-on-device-scan.patch	2021-11-10 14:17:01.864079479 +0800
@@ -1 +1 @@
-From c6c865d7e2e47a3a1a65a091103cca056bb073ef Mon Sep 17 00:00:00 2001
+From a00d38a2e164c755bfb96192c3da52cc7db4d935 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit c6c865d7e2e47a3a1a65a091103cca056bb073ef ]
@@ -12 +14,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list