Netdev List
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Chenguang Zhao <chenguang.zhao@linux.dev>,
	<jiawenwu@trustnetic.com>, <mengyuanlou@net-swift.com>,
	<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, Chenguang Zhao <zhaochenguang@kylinos.cn>
Subject: Re: [PATCH net] net: txgbe: fix FDIR filter leak on remove
Date: Tue, 14 Jul 2026 17:30:57 -0700	[thread overview]
Message-ID: <20bb3c63-b66e-4ef2-a230-481609b7f186@intel.com> (raw)
In-Reply-To: <20260713091911.1614795-1-chenguang.zhao@linux.dev>

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


      reply	other threads:[~2026-07-15  0:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=20bb3c63-b66e-4ef2-a230-481609b7f186@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=chenguang.zhao@linux.dev \
    --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