patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: David Marchand <david.marchand@redhat.com>
Cc: Chenbo Xia <chenbo.xia@intel.com>, dpdk stable <stable@dpdk.org>
Subject: patch 'net/vhost: fix leak in interrupt handle setup' has been queued to stable release 21.11.4
Date: Wed, 22 Mar 2023 10:31:57 +0000	[thread overview]
Message-ID: <20230322103209.456098-10-ktraynor@redhat.com> (raw)
In-Reply-To: <20230322103209.456098-1-ktraynor@redhat.com>

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@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@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@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@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)


  parent reply	other threads:[~2023-03-22 10:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 10:31 patch 'raw/skeleton: fix selftest' " Kevin Traynor
2023-03-22 10:31 ` patch 'reorder: fix sequence number mbuf field register' " Kevin Traynor
2023-03-22 10:31 ` patch 'test: fix segment length in packet generator' " Kevin Traynor
2023-03-22 10:31 ` patch 'test/mbuf: fix test with mbuf debug enabled' " Kevin Traynor
2023-03-22 10:31 ` patch 'test/crypto: fix ZUC digest length in comparison' " Kevin Traynor
2023-03-22 10:31 ` patch 'test/crypto: fix capability check for ZUC cipher-auth' " Kevin Traynor
2023-03-22 10:31 ` patch 'app/compress-perf: fix remaining data for ops' " Kevin Traynor
2023-03-22 10:31 ` patch 'app/bbdev: check statistics failure' " Kevin Traynor
2023-03-22 10:31 ` patch 'net/vhost: add missing newline in logs' " Kevin Traynor
2023-03-22 10:31 ` Kevin Traynor [this message]
2023-03-22 10:31 ` patch 'net/vhost: fix Rx interrupt' " Kevin Traynor
2023-03-22 10:31 ` patch 'net/virtio: remove address width limit for modern devices' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/sfc: invalidate switch port entry on representor unplug' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/i40e: fix AVX512 fast-free path' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/e1000: fix saving of stripped VLAN TCI' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/i40e: fix MAC loopback on X722' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/iavf: fix device stop during reset' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/mlx5: fix hairpin Tx queue reference count' " Kevin Traynor
2023-03-22 10:32 ` patch 'doc: fix LPM support in l3forward guide' " Kevin Traynor
2023-03-22 10:32 ` patch 'bus/ifpga: fix devargs handling' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/ipn3ke: fix thread exit' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/ipn3ke: fix representor name' " Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230322103209.456098-10-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).