mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sicong  <congei42@163.com>
To: "Edward Cree" <ecree.xilinx@gmail.com>
Cc: netdev@vger.kernel.org, "Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>, "Kees Cook" <kees@kernel.org>,
	linux-net-drivers@amd.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] sfc: fix use-after-free of filter_work in efx_realloc_channels()
Date: Fri, 23 Oct 2026 11:21:53 +0800 (CST)	[thread overview]
Message-ID: <5a7bfee.32ee.1a166c781b9.Coremail.congei42@163.com> (raw)
In-Reply-To: <46fdec20-c37b-4d7a-afa1-3caadcfc4640@gmail.com>

At 2026-10-22 22:36:52, "Edward Cree" <ecree.xilinx@gmail.com> wrote:
>The analysis looks correct, but I wonder if rather than placing the
> cancel_delayed_work_sync() inline in efx_realloc_channels(), it should
> be done by efx_remove_channel() (or rolled up with the kfree() into a
> new efx_free_channel(), since it's undoing efx_alloc_channel() rather
> than efx_probe_channel()), to reduce the risk of the same race popping
> up elsewhere.  Consumers of the channels API should not need to know
> that they have to do this 'magic' cancel to safely free a channel,
> that's a layering violation.

Thanks for the review, that makes sense.

I went with efx_free_channel(). It cancels filter_work synchronously
and then frees the channel, and both efx_realloc_channels() and
efx_fini_channels() now use it instead of calling kfree() directly.
The Siena driver gets the same change.

>(Actually, it's a layering violation that filter_work even lives in the
> efx_channel and not its efx_rx_queue, but I never had time to fix that
> and am now not likely to — I commend the idea to future maintainers.)

That seems like a bigger refactor than belongs in a fix for net, so
I've left it out of this patch.

I'll send v2 as a separate thread.

Thanks,
Sicong





      reply	other threads:[~2026-10-23  3:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 13:39 Sicong Huang
2026-10-22 13:47 ` netdev-bot+sinfo
2026-10-22 14:36 ` Edward Cree
2026-10-23  3:21   ` sicong [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=5a7bfee.32ee.1a166c781b9.Coremail.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®