patch 'net/netvsc: fix resource leak on init failure' has been queued to stable release 24.11.5
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Thu Mar 19 23:02:37 CET 2026
Hi,
FYI, your patch has been queued to stable release 24.11.5
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/21/26. 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/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/b76b85ad171608c13d5709b1337c0252133bb6f9
Thanks.
Luca Boccassi
---
>From b76b85ad171608c13d5709b1337c0252133bb6f9 Mon Sep 17 00:00:00 2001
From: Long Li <longli at microsoft.com>
Date: Tue, 3 Mar 2026 12:54:06 -0800
Subject: [PATCH] net/netvsc: fix resource leak on init failure
[ upstream commit 7971a129ef27e35b7ea9a4e977193476c063640e ]
The failed label in eth_hn_dev_init() does not free hv->primary or close
hv->channels[0], leaking both resources on any init failure after they
are allocated.
Additionally, the early return when hv->primary allocation fails leaks
hv->channels[0]. Change it to goto failed.
Add rte_free(hv->primary) and rte_vmbus_chan_close(hv->channels[0]) to
the failed label to properly clean up on all error paths.
Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Signed-off-by: Long Li <longli at microsoft.com>
---
drivers/net/netvsc/hn_ethdev.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 1e4b7c8d8c..41274790e3 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -1348,8 +1348,10 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev)
hv->primary = hn_rx_queue_alloc(hv, 0,
eth_dev->device->numa_node);
- if (!hv->primary)
- return -ENOMEM;
+ if (!hv->primary) {
+ err = -ENOMEM;
+ goto failed;
+ }
err = hn_attach(hv, RTE_ETHER_MTU);
if (err)
@@ -1375,8 +1377,10 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev)
max_chan = rte_vmbus_max_channels(vmbus);
PMD_INIT_LOG(DEBUG, "VMBus max channels %d", max_chan);
- if (max_chan <= 0)
+ if (max_chan <= 0) {
+ err = max_chan ? max_chan : -ENODEV;
goto failed;
+ }
if (hn_rndis_query_rsscaps(hv, &rxr_cnt) != 0)
rxr_cnt = 1;
@@ -1398,6 +1402,8 @@ failed:
hn_chim_uninit(eth_dev);
hn_detach(hv);
+ rte_free(hv->primary);
+ rte_vmbus_chan_close(hv->channels[0]);
return err;
}
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-03-19 22:00:49.419285666 +0000
+++ 0045-net-netvsc-fix-resource-leak-on-init-failure.patch 2026-03-19 22:00:47.814359367 +0000
@@ -1 +1 @@
-From 7971a129ef27e35b7ea9a4e977193476c063640e Mon Sep 17 00:00:00 2001
+From b76b85ad171608c13d5709b1337c0252133bb6f9 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 7971a129ef27e35b7ea9a4e977193476c063640e ]
+
@@ -17 +18,0 @@
-Cc: stable at dpdk.org
@@ -25 +26 @@
-index 5a5b77aa4c..0aa08de390 100644
+index 1e4b7c8d8c..41274790e3 100644
@@ -28 +29 @@
-@@ -1406,8 +1406,10 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev)
+@@ -1348,8 +1348,10 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev)
@@ -41 +42 @@
-@@ -1433,8 +1435,10 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev)
+@@ -1375,8 +1377,10 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev)
@@ -53 +54 @@
-@@ -1456,6 +1460,8 @@ failed:
+@@ -1398,6 +1402,8 @@ failed:
More information about the stable
mailing list