Skip to contentSkip to conversation

net: txgbe: fix FDIR filter leak on remove

PATCH Applied Chenguang Zhao 3 participants 3 messages Jul 13 – Jul 21

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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.

Fixes 4bdb441105dc ("net: txgbe: support Flow Director perfect filters")

---
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
index 20c5a295c6c2..c277863baf67 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
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 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")
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() 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).

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
index 20c5a295c6c2..c277863baf67 100644
@@ -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 lore raw
In reply to Chenguang Zhao
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 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.

[...]

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