patch 'net/vhost: fix leak in interrupt handle setup' has been queued to stable release 21.11.4

Kevin Traynor ktraynor at redhat.com
Wed Mar 22 11:31:57 CET 2023


Hi,

FYI, your patch has been queued to stable release 21.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 03/24/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://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/a38b2e569315d093d9dd58ed572ca3951319d419

Thanks.

Kevin

---
>From a38b2e569315d093d9dd58ed572ca3951319d419 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Thu, 9 Mar 2023 13:37:51 +0100
Subject: [PATCH] net/vhost: fix leak in interrupt handle setup

[ upstream commit 24c3a04e16aeab45719cf038d2371ccf8d1bc780 ]

Do a systematic cleanup if any part of the interrupt handle setup fails.

Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 53 ++++++++++++++++++++-----------
 1 file changed, 34 insertions(+), 19 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index ad2d52475d..31ff871bbc 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -661,14 +661,16 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
 	if (dev->intr_handle == NULL) {
 		VHOST_LOG(ERR, "Fail to allocate intr_handle\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto error;
+	}
+	if (rte_intr_efd_counter_size_set(dev->intr_handle, sizeof(uint64_t))) {
+		ret = -rte_errno;
+		goto error;
 	}
-	if (rte_intr_efd_counter_size_set(dev->intr_handle, sizeof(uint64_t)))
-		return -rte_errno;
 
 	if (rte_intr_vec_list_alloc(dev->intr_handle, NULL, nb_rxq)) {
-		VHOST_LOG(ERR,
-			"Failed to allocate memory for interrupt vector\n");
-		rte_intr_instance_free(dev->intr_handle);
-		return -ENOMEM;
+		VHOST_LOG(ERR, "Failed to allocate memory for interrupt vector\n");
+		ret = -ENOMEM;
+		goto error;
 	}
 
@@ -676,8 +678,13 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
 	VHOST_LOG(INFO, "Prepare intr vec\n");
 	for (i = 0; i < nb_rxq; i++) {
-		if (rte_intr_vec_list_index_set(dev->intr_handle, i, RTE_INTR_VEC_RXTX_OFFSET + i))
-			return -rte_errno;
-		if (rte_intr_efds_index_set(dev->intr_handle, i, -1))
-			return -rte_errno;
+		if (rte_intr_vec_list_index_set(dev->intr_handle, i,
+				RTE_INTR_VEC_RXTX_OFFSET + i)) {
+			ret = -rte_errno;
+			goto error;
+		}
+		if (rte_intr_efds_index_set(dev->intr_handle, i, -1)) {
+			ret = -rte_errno;
+			goto error;
+		}
 		vq = dev->data->rx_queues[i];
 		if (!vq) {
@@ -704,14 +711,22 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
 	}
 
-	if (rte_intr_nb_efd_set(dev->intr_handle, nb_rxq))
-		return -rte_errno;
-
-	if (rte_intr_max_intr_set(dev->intr_handle, nb_rxq + 1))
-		return -rte_errno;
-
-	if (rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_VDEV))
-		return -rte_errno;
+	if (rte_intr_nb_efd_set(dev->intr_handle, nb_rxq)) {
+		ret = -rte_errno;
+		goto error;
+	}
+	if (rte_intr_max_intr_set(dev->intr_handle, nb_rxq + 1)) {
+		ret = -rte_errno;
+		goto error;
+	}
+	if (rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_VDEV)) {
+		ret = -rte_errno;
+		goto error;
+	}
 
 	return 0;
+
+error:
+	eth_vhost_uninstall_intr(dev);
+	return ret;
 }
 
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.180116749 +0000
+++ 0010-net-vhost-fix-leak-in-interrupt-handle-setup.patch	2023-03-22 10:30:07.911866560 +0000
@@ -1 +1 @@
-From 24c3a04e16aeab45719cf038d2371ccf8d1bc780 Mon Sep 17 00:00:00 2001
+From a38b2e569315d093d9dd58ed572ca3951319d419 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 24c3a04e16aeab45719cf038d2371ccf8d1bc780 ]
+
@@ -9 +10,0 @@
-Cc: stable at dpdk.org
@@ -18 +19 @@
-index 198bf4d1f4..96deb18d91 100644
+index ad2d52475d..31ff871bbc 100644
@@ -21 +22 @@
-@@ -687,14 +687,16 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
+@@ -661,14 +661,16 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
@@ -45 +46 @@
-@@ -702,8 +704,13 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
+@@ -676,8 +678,13 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
@@ -63 +64 @@
-@@ -730,14 +737,22 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
+@@ -704,14 +711,22 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)



More information about the stable mailing list