[dpdk-stable] patch 'net/netvsc: fix Tx queue leak in error path' has been queued to stable release 19.11.6

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Oct 28 11:45:23 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 81bb7d7c3ef7d0355d78ac31ff4f8b228facfa7e Mon Sep 17 00:00:00 2001
From: Yunjian Wang <wangyunjian at huawei.com>
Date: Wed, 7 Oct 2020 10:06:25 +0800
Subject: [PATCH] net/netvsc: fix Tx queue leak in error path

[ upstream commit f3013acfc17b8920b97223421976f3b3bb32489a ]

In hn_dev_tx_queue_setup() allocated memory for txq, we don't free it
when error happens and it will lead to memory leak.

We can check for tx_free_thresh at the beginning of the function to
fix it, before calling txq = rte_zmalloc_socket().

Fixes: cc0251813277 ("net/netvsc: split send buffers from Tx descriptors")

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Acked-by: Long Li <longli at microsoft.com>
---
 drivers/net/netvsc/hn_rxtx.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 90ec8d7d57..460f1bc57f 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -252,16 +252,6 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev,
 
 	PMD_INIT_FUNC_TRACE();
 
-	txq = rte_zmalloc_socket("HN_TXQ", sizeof(*txq), RTE_CACHE_LINE_SIZE,
-				 socket_id);
-	if (!txq)
-		return -ENOMEM;
-
-	txq->hv = hv;
-	txq->chan = hv->channels[queue_idx];
-	txq->port_id = dev->data->port_id;
-	txq->queue_id = queue_idx;
-
 	tx_free_thresh = tx_conf->tx_free_thresh;
 	if (tx_free_thresh == 0)
 		tx_free_thresh = RTE_MIN(nb_desc / 4,
@@ -276,6 +266,15 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
+	txq = rte_zmalloc_socket("HN_TXQ", sizeof(*txq), RTE_CACHE_LINE_SIZE,
+				 socket_id);
+	if (!txq)
+		return -ENOMEM;
+
+	txq->hv = hv;
+	txq->chan = hv->channels[queue_idx];
+	txq->port_id = dev->data->port_id;
+	txq->queue_id = queue_idx;
 	txq->free_thresh = tx_free_thresh;
 
 	snprintf(name, sizeof(name),
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-10-28 10:35:16.817761445 +0000
+++ 0164-net-netvsc-fix-Tx-queue-leak-in-error-path.patch	2020-10-28 10:35:11.764833851 +0000
@@ -1,8 +1,10 @@
-From f3013acfc17b8920b97223421976f3b3bb32489a Mon Sep 17 00:00:00 2001
+From 81bb7d7c3ef7d0355d78ac31ff4f8b228facfa7e Mon Sep 17 00:00:00 2001
 From: Yunjian Wang <wangyunjian at huawei.com>
 Date: Wed, 7 Oct 2020 10:06:25 +0800
 Subject: [PATCH] net/netvsc: fix Tx queue leak in error path
 
+[ upstream commit f3013acfc17b8920b97223421976f3b3bb32489a ]
+
 In hn_dev_tx_queue_setup() allocated memory for txq, we don't free it
 when error happens and it will lead to memory leak.
 
@@ -10,7 +12,6 @@
 fix it, before calling txq = rte_zmalloc_socket().
 
 Fixes: cc0251813277 ("net/netvsc: split send buffers from Tx descriptors")
-Cc: stable at dpdk.org
 
 Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
 Acked-by: Long Li <longli at microsoft.com>
@@ -19,7 +20,7 @@
  1 file changed, 9 insertions(+), 10 deletions(-)
 
 diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
-index 65f1abae51..5d59db513c 100644
+index 90ec8d7d57..460f1bc57f 100644
 --- a/drivers/net/netvsc/hn_rxtx.c
 +++ b/drivers/net/netvsc/hn_rxtx.c
 @@ -252,16 +252,6 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev,


More information about the stable mailing list