[dpdk-stable] patch 'bus/pci: fix leak on VFIO mapping error' has been queued to stable release 19.11.6

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Oct 28 11:44:22 CET 2020


Hi,

FYI, your patch has been queued to stable release 19.11.6

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

Thanks.

Luca Boccassi

---
>From 6fb58ea15dbb2e1edd1ffa1217fc58f044ed3d6d Mon Sep 17 00:00:00 2001
From: Yunjian Wang <wangyunjian at huawei.com>
Date: Fri, 11 Sep 2020 19:08:04 +0800
Subject: [PATCH] bus/pci: fix leak on VFIO mapping error

[ upstream commit 2a089d2d52f45bca6f179345fa3f3abe1a0e2ea9 ]

Currently, only the 'vfio_dev_fd' is closed in failure path, so
some resources are not released(such as 'vfio_group_fd'). The
rte_vfio_release_device() should be used to avoid this problem.

Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping")

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 drivers/bus/pci/linux/pci_vfio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 5dcf15424c..a0bb1f5fd3 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -826,7 +826,8 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 err_vfio_res:
 	rte_free(vfio_res);
 err_vfio_dev_fd:
-	close(vfio_dev_fd);
+	rte_vfio_release_device(rte_pci_get_sysfs_path(),
+			pci_addr, vfio_dev_fd);
 	return -1;
 }
 
@@ -894,7 +895,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 
 	return 0;
 err_vfio_dev_fd:
-	close(vfio_dev_fd);
+	rte_vfio_release_device(rte_pci_get_sysfs_path(),
+			pci_addr, vfio_dev_fd);
 	return -1;
 }
 
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-10-28 10:35:14.976545325 +0000
+++ 0103-bus-pci-fix-leak-on-VFIO-mapping-error.patch	2020-10-28 10:35:11.656832261 +0000
@@ -1,14 +1,15 @@
-From 2a089d2d52f45bca6f179345fa3f3abe1a0e2ea9 Mon Sep 17 00:00:00 2001
+From 6fb58ea15dbb2e1edd1ffa1217fc58f044ed3d6d Mon Sep 17 00:00:00 2001
 From: Yunjian Wang <wangyunjian at huawei.com>
 Date: Fri, 11 Sep 2020 19:08:04 +0800
 Subject: [PATCH] bus/pci: fix leak on VFIO mapping error
 
+[ upstream commit 2a089d2d52f45bca6f179345fa3f3abe1a0e2ea9 ]
+
 Currently, only the 'vfio_dev_fd' is closed in failure path, so
 some resources are not released(such as 'vfio_group_fd'). The
 rte_vfio_release_device() should be used to avoid this problem.
 
 Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping")
-Cc: stable at dpdk.org
 
 Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
 Reviewed-by: Anatoly Burakov <anatoly.burakov at intel.com>
@@ -17,10 +18,10 @@
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
-index 940ebc1e35..ef4f72017f 100644
+index 5dcf15424c..a0bb1f5fd3 100644
 --- a/drivers/bus/pci/linux/pci_vfio.c
 +++ b/drivers/bus/pci/linux/pci_vfio.c
-@@ -838,7 +838,8 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
+@@ -826,7 +826,8 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
  err_vfio_res:
  	rte_free(vfio_res);
  err_vfio_dev_fd:
@@ -30,7 +31,7 @@
  	return -1;
  }
  
-@@ -906,7 +907,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
+@@ -894,7 +895,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
  
  	return 0;
  err_vfio_dev_fd:


More information about the stable mailing list