mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sicong Huang <congei42@163.com>
To: netdev@vger.kernel.org
Cc: ecree.xilinx@gmail.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, kees@kernel.org, linux-net-drivers@amd.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH net v3 0/2] sfc: fix use-after-free of aRFS work on ring resize
Date: Sat, 31 Oct 2026 14:38:21 +0800	[thread overview]
Message-ID: <20261031063823.876645-1-congei42@163.com> (raw)

This series fixes aRFS work lifetime and state-copying races when
ethtool -G replaces channel structures. Both sfc and Siena are affected.

Patch 1 keeps expiry cancellation inside efx_free_channel() and re-arms
expiry on the surviving channels, including allocation failure and probe
rollback. Patch 2 prevents new insertion requests while the net_device
is detached, waits for pre-detach receive callbacks and insertion work,
and cancels expiry before copying the channels.

Stopping NAPI alone does not stop deferred PTP receive processing from
submitting aRFS requests. The insertion entry point therefore checks
netif_device_present(), paired with synchronize_net() on the resize
path. All insertion work items are initialised once and flushed without
using the in-flight bitmap as a completion test.

Changes in v3:
- Re-arm expiry after channel replacement, including failure paths,
  so it continues without further NAPI polls. (Sashiko, Paolo Abeni)
- Add patch 2 for the insertion-work UAF and expiry-copy race reported
  by Sashiko. Cover deferred receive processing as well as NAPI.
- Retain the original Fixes tag: asynchronous expiry already needed
  flushing before the later change that added periodic re-arming.
- State the discovery method and testing limits.

Changes in v2:
- Introduce efx_free_channel() to encapsulate expiry cancellation in
  the channel deallocation helper. (Edward Cree)
- Add the Fixes tag.

Testing: the modified translation units build with GCC 11 on x86_64,
W=1 and CONFIG_RFS_ACCEL both enabled and disabled. No hardware testing
or runtime reproduction has been performed.

v2: https://lore.kernel.org/netdev/20261023134214.322796-1-congei42@163.com/
v1: https://lore.kernel.org/netdev/20261022133927.3860186-1-congei42@163.com/

Sicong Huang (2):
  sfc: fix use-after-free of filter_work in efx_realloc_channels()
  sfc: quiesce aRFS work before copying channels in
    efx_realloc_channels()

 drivers/net/ethernet/sfc/efx_channels.c       | 35 +++++++++++++++++--
 drivers/net/ethernet/sfc/efx_common.c         |  1 +
 drivers/net/ethernet/sfc/rx_common.c          | 30 +++++++++++++++-
 drivers/net/ethernet/sfc/rx_common.h          |  2 ++
 drivers/net/ethernet/sfc/siena/efx_channels.c | 35 +++++++++++++++++--
 drivers/net/ethernet/sfc/siena/efx_common.c   |  1 +
 drivers/net/ethernet/sfc/siena/rx_common.c    | 30 +++++++++++++++-
 drivers/net/ethernet/sfc/siena/rx_common.h    |  2 ++
 8 files changed, 130 insertions(+), 6 deletions(-)


base-commit: f4377bf85887f57b59abb5479f7660a81ffe4449
-- 
2.34.1


             reply	other threads:[~2026-10-31  6:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31  6:38 Sicong Huang [this message]
2026-10-31  6:38 ` [PATCH net v3 1/2] sfc: fix use-after-free of filter_work in efx_realloc_channels() Sicong Huang
2026-11-01  6:41   ` netdev-bot+sashiko
2026-10-31  6:38 ` [PATCH net v3 2/2] sfc: quiesce aRFS work before copying channels " Sicong Huang

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=20261031063823.876645-1-congei42@163.com \
    --to=congei42@163.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net-drivers@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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

all inboxes | Powered by JetHome®