From: Long Li <longli@microsoft.com>
To: dev@dpdk.org
Cc: stephen@networkplumber.org, longli@microsoft.com,
weh@microsoft.com, stable@dpdk.org
Subject: [PATCH v4 4/6] net/netvsc: fix event callback leak on rxfilter failure
Date: Tue, 3 Mar 2026 12:54:07 -0800 [thread overview]
Message-ID: <20260303205411.325585-5-longli@microsoft.com> (raw)
In-Reply-To: <20260303205411.325585-1-longli@microsoft.com>
In hn_dev_start(), if hn_rndis_set_rxfilter() fails after registering
the device event callback, the function returns without unregistering
the callback. Unregister it before returning on error.
Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Cc: stable@dpdk.org
Signed-off-by: Long Li <longli@microsoft.com>
---
drivers/net/netvsc/hn_ethdev.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 19721b4829..5e954b8812 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -1043,16 +1043,22 @@ hn_dev_start(struct rte_eth_dev *dev)
NDIS_PACKET_TYPE_BROADCAST |
NDIS_PACKET_TYPE_ALL_MULTICAST |
NDIS_PACKET_TYPE_DIRECTED);
- if (error)
+ if (error) {
+ rte_dev_event_callback_unregister(NULL,
+ netvsc_hotadd_callback, hv);
return error;
+ }
error = hn_vf_start(dev);
- if (error)
+ if (error) {
hn_rndis_set_rxfilter(hv, 0);
+ rte_dev_event_callback_unregister(NULL,
+ netvsc_hotadd_callback, hv);
+ return error;
+ }
/* Initialize Link state */
- if (error == 0)
- hn_dev_link_update(dev, 0);
+ hn_dev_link_update(dev, 0);
for (i = 0; i < hv->num_queues; i++) {
dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
--
2.43.0
next prev parent reply other threads:[~2026-03-03 20:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 20:54 [PATCH v4 0/6] net/netvsc: bug fixes and runtime queue reconfiguration Long Li
2026-03-03 20:54 ` [PATCH v4 1/6] net/netvsc: fix subchannel leak on device removal Long Li
2026-03-03 20:54 ` [PATCH v4 2/6] net/netvsc: fix double-free of primary Rx queue on uninit Long Li
2026-03-03 20:54 ` [PATCH v4 3/6] net/netvsc: fix resource leak in init error path Long Li
2026-03-03 20:54 ` Long Li [this message]
2026-03-03 20:54 ` [PATCH v4 5/6] net/netvsc: fix resource leaks in MTU change path Long Li
2026-03-03 20:54 ` [PATCH v4 6/6] net/netvsc: support runtime queue count reconfiguration Long Li
2026-03-03 22:16 ` [PATCH v4 0/6] net/netvsc: bug fixes and runtime queue reconfiguration Stephen Hemminger
2026-03-03 22:30 ` [EXTERNAL] " Long Li
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=20260303205411.325585-5-longli@microsoft.com \
--to=longli@microsoft.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=weh@microsoft.com \
/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