net: txgbe: fix FDIR filter leak on remove
Subsystems (3)
PATCH 1/1 net: txgbe: fix FDIR filter leak on remove
From: Chenguang Zhao <[email protected]>
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.
---
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(+)
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c +1 -0
@@ -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);
Signature · 1 line
2.25.1
Quoted 10 lines · Chenguang Zhao
From: Chenguang Zhao <[email protected]>
Perfect FDIR filters can be added while the interface is down and are kept on the software list for later restore.
unregister_netdev()only callsndo_stopwhen the device is up, sotxgbe_fdir_filter_exit()intxgbe_close()is skipped in that case and the filters are leaked on driver remove. Free the filter list fromtxgbe_remove()as well.Fixes 4bdb441105dc ("net: txgbe: support Flow Director perfect filters")Signed-off-by Chenguang Zhao <[email protected]>
Quoted 12 lines
---
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()skipsndo_stopbecause the device is notIFF_UP, and without freeing the software filter list in remove, each rule leakssizeof(struct txgbe_fdir_filter).
Appreciate the reproduction steps here. Helps detail the way the leak sneaks in.
Quoted 15 lines
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 1 + 1 file changed, 1 insertion(+)drivers/net/ethernet/wangxun/txgbe/txgbe_main.c +1
-0@@ -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);
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Mon, 13 Jul 2026 17:19:11 +0800 you wrote:
From: Chenguang Zhao <[email protected]>
Perfect FDIR filters can be added while the interface is down and are kept on the software list for later restore.
unregister_netdev()only callsndo_stopwhen the device is up, sotxgbe_fdir_filter_exit()intxgbe_close()is skipped in that case and the filters are leaked on driver remove. Free the filter list fromtxgbe_remove()as well.[...]
Here is the summary with links:
- [net] net: txgbe: fix FDIR filter leak on remove
https://git.kernel.org/netdev/net/c/ecaa37826340
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html