Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: txgbe: fix FDIR filter leak on remove
@ 2026-07-13  9:19 Chenguang Zhao
  2026-07-15  0:30 ` Jacob Keller
  0 siblings, 1 reply; 2+ messages in thread
From: Chenguang Zhao @ 2026-07-13  9:19 UTC (permalink / raw)
  To: jiawenwu, mengyuanlou, andrew+netdev, davem, edumazet, kuba,
	pabeni
  Cc: chenguang.zhao, netdev, Chenguang Zhao

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: txgbe: fix FDIR filter leak on remove
  2026-07-13  9:19 [PATCH net] net: txgbe: fix FDIR filter leak on remove Chenguang Zhao
@ 2026-07-15  0:30 ` Jacob Keller
  0 siblings, 0 replies; 2+ messages in thread
From: Jacob Keller @ 2026-07-15  0:30 UTC (permalink / raw)
  To: Chenguang Zhao, jiawenwu, mengyuanlou, andrew+netdev, davem,
	edumazet, kuba, pabeni
  Cc: netdev, Chenguang Zhao

On 7/13/2026 2:19 AM, Chenguang Zhao wrote:
> 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).
> 

Appreciate the reproduction steps here. Helps detail the way the leak
sneaks in.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>  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);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-15  0:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13  9:19 [PATCH net] net: txgbe: fix FDIR filter leak on remove Chenguang Zhao
2026-07-15  0:30 ` Jacob Keller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox