All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: 徐晗翔 <xuhx@hust.edu.cn>
Cc: stefan@datenfreihafen.org,  alex.aring@gmail.com,
	linux-wpan@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: ieee802154: mcr20a/mrf24j40/at86rf230: unbind while the SPI completion chain is in flight operates on freed driver data (use-after-free, three same-shaped drivers)
Date: Thu, 22 Oct 2026 11:54:40 +0200	[thread overview]
Message-ID: <87se1yqcv3.fsf@bootlin.com> (raw)
In-Reply-To: <4d2e91a4.14801.1a162d3f5d6.Coremail.xuhx@hust.edu.cn> ("徐晗翔 "'s message of "Thu, 22 Oct 2026 16:57:00 +0800 (GMT+08:00)")

Hi,

On 22/10/2026 at 16:57:00 +08, 徐晗翔 <xuhx@hust.edu.cn> wrote:

> Unbinding (or rmmod-ing, or hot-unplugging) any of the three in-tree
> ieee802154 SPI transceiver drivers while their IRQ-driven completion
> chain is in flight leaves the chain running on freed memory: the async
> SPI messages and their completion context are owned by the controller
> queue, but the callbacks only hold bare pointers to the driver private
> data and regmap, so after remove() frees the private data (and devres
> later frees the regmap), the still-queued chain steps read and write
> freed memory and even derive new spi_async() submissions from the freed
> spi_device -- a use-after-free family confirmed with KASAN on mainline
> 7.3 (42 reports in one unbind, three-stack closure probe/unbind/kworker;
> clean unbind when the chain happens to be idle).

This is indeed possible, even though not a huge deal since SPI devices
are by nature not hot-pluggable and the two other operations require
to be root.

You can send patches if you want to see these fixed.

Thanks,
Miquèl

      reply	other threads:[~2026-10-22  9:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22  8:57 ieee802154: mcr20a/mrf24j40/at86rf230: unbind while the SPI completion chain is in flight operates on freed driver data (use-after-free, three same-shaped drivers) 徐晗翔
2026-10-22  9:54 ` Miquel Raynal [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=87se1yqcv3.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=alex.aring@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=stefan@datenfreihafen.org \
    --cc=xuhx@hust.edu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.