From: Chenguang Zhao <chenguang.zhao@linux.dev>
To: jiawenwu@trustnetic.com, mengyuanlou@net-swift.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com
Cc: chenguang.zhao@linux.dev, netdev@vger.kernel.org,
Chenguang Zhao <zhaochenguang@kylinos.cn>
Subject: [PATCH net] net: txgbe: fix FDIR filter leak on remove
Date: Mon, 13 Jul 2026 17:19:11 +0800 [thread overview]
Message-ID: <20260713091911.1614795-1-chenguang.zhao@linux.dev> (raw)
From: Chenguang Zhao <zhaochenguang@kylinos.cn>
Perfect FDIR filters can be added while the interface is down and are
kept on the software list for later restore. unregister_netdev() only
calls ndo_stop when the device is up, so txgbe_fdir_filter_exit() in
txgbe_close() is skipped in that case and the filters are leaked on
driver remove. Free the filter list from txgbe_remove() as well.
Fixes: 4bdb441105dc ("net: txgbe: support Flow Director perfect filters")
Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
---
Reproduction:
1. Load the driver (interface remains down after probe).
2. Enable ntuple filters: ethtool -K <dev> ntuple on
3. Add a perfect FDIR rule while the interface is down:
ethtool -N <dev> flow-type ...
4. Keep the interface down (do not bring it up).
5. Unload the driver (rmmod / PCI unbind).
unregister_netdev() skips ndo_stop because the device is not IFF_UP,
and without freeing the software filter list in remove, each rule
leaks sizeof(struct txgbe_fdir_filter).
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
index 20c5a295c6c2..c277863baf67 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
@@ -945,6 +945,7 @@ static void txgbe_remove(struct pci_dev *pdev)
netdev = wx->netdev;
wx_disable_sriov(wx);
unregister_netdev(netdev);
+ txgbe_fdir_filter_exit(wx);
timer_shutdown_sync(&wx->service_timer);
cancel_work_sync(&wx->service_task);
--
2.25.1
next reply other threads:[~2026-07-13 9:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 9:19 Chenguang Zhao [this message]
2026-07-15 0:30 ` [PATCH net] net: txgbe: fix FDIR filter leak on remove Jacob Keller
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=20260713091911.1614795-1-chenguang.zhao@linux.dev \
--to=chenguang.zhao@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiawenwu@trustnetic.com \
--cc=kuba@kernel.org \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zhaochenguang@kylinos.cn \
/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