patch 'drivers/bus: fix leak for devices without driver' has been queued to stable release 22.11.2

Xueming Li xuemingl at nvidia.com
Mon Feb 27 07:59:48 CET 2023


Hi,

FYI, your patch has been queued to stable release 22.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/01/23. 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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=cc69b3523ec0d264f254c1d4451bfc6534a6a801

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From cc69b3523ec0d264f254c1d4451bfc6534a6a801 Mon Sep 17 00:00:00 2001
From: Volodymyr Fialko <vfialko at marvell.com>
Date: Thu, 9 Feb 2023 14:22:07 +0100
Subject: [PATCH] drivers/bus: fix leak for devices without driver
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit deb44af7066a17b1d2bab180cbe98ccae6e253ca ]

During the bus scan, memory for device configuration is allocated.
Currently, if a driver wasn't attached to the device during initialization,
memory for that device will not be released at bus cleanup.
This patch address this issue and releases the memory for all allocated
devices.

Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")

Signed-off-by: Volodymyr Fialko <vfialko at marvell.com>
Acked-by: Kevin Laatz <kevin.laatz at intel.com>
---
 drivers/bus/pci/pci_common.c | 3 ++-
 drivers/bus/vdev/vdev.c      | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index bc3a7f39fe..e32a9d517a 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -448,7 +448,7 @@ pci_cleanup(void)
 		int ret = 0;

 		if (drv == NULL || drv->remove == NULL)
-			continue;
+			goto free;

 		ret = drv->remove(dev);
 		if (ret < 0) {
@@ -458,6 +458,7 @@ pci_cleanup(void)
 		dev->driver = NULL;
 		dev->device.driver = NULL;

+free:
 		/* free interrupt handles */
 		rte_intr_instance_free(dev->intr_handle);
 		dev->intr_handle = NULL;
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 41bc07dde7..7974b27295 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -578,18 +578,19 @@ vdev_cleanup(void)
 		int ret = 0;

 		if (dev->device.driver == NULL)
-			continue;
+			goto free;

 		drv = container_of(dev->device.driver, const struct rte_vdev_driver, driver);

 		if (drv->remove == NULL)
-			continue;
+			goto free;

 		ret = drv->remove(dev);
 		if (ret < 0)
 			error = -1;

 		dev->device.driver = NULL;
+free:
 		free(dev);
 	}

--
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-02-27 14:08:43.488801400 +0800
+++ 0081-drivers-bus-fix-leak-for-devices-without-driver.patch	2023-02-27 14:08:40.799237000 +0800
@@ -1 +1 @@
-From deb44af7066a17b1d2bab180cbe98ccae6e253ca Mon Sep 17 00:00:00 2001
+From cc69b3523ec0d264f254c1d4451bfc6534a6a801 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit deb44af7066a17b1d2bab180cbe98ccae6e253ca ]
@@ -13 +15,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list