Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 1/2] power: sequencing: pcie-m2: fix use-after-free in pwrseq_pcie_m2_vregs_enable()
Date: Thu, 05 Nov 2026 08:38:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-198730@kernel.org> (raw)
In-Reply-To: <20261105-pwrseq-pcie-m2-uaf-v2-1-3e1dd415af9a@oss.qualcomm.com>

> During device teardown or on the probe error path, a concurrent consumer
> access triggers a use-after-free in pwrseq_pcie_m2_vregs_enable() or
> pwrseq_pcie_m2_vregs_disable() due to a lifetime inversion between
> devm-managed device registration and manual resource cleanup.
> 
> The driver exposes the power sequencer using devm_pwrseq_device_register(),
> meaning the device remains fully registered and accessible on the
> pwrseq_bus until the driver core schedules devm_pwrseq_device_unregister()
> to run after pwrseq_pcie_m2_remove() returns. However, the driver performs
> manual resource teardown within pwrseq_pcie_m2_remove() and the
> pwrseq_pcie_m2_probe() error path, prematurely destroying the backing
> regulator array.
> 
> This creates a narrow vulnerability window where the globally visible power
> sequencer is backed by freed memory. If a concurrent consumer invokes
> pwrseq_enable() during this window, execution is routed to the sequencer
> callback and dereferences the destroyed ctx->regs array, resulting in a
> direct use-after-free and a kernel crash.
> 
> Schedule a devres action for freeing the memory used for the regulator
> array to ensure it runs *after* the pwrseq provider was unregistered.
> 
> Cc: stable@vger.kernel.org
> Fixes: 3f736aecbdc8 ("power: sequencing: pcie-m2: Create serdev device for WCN7850 bluetooth")
> Closes: https://sashiko.dev/#/bug/linux-bd17e5b1-a000-4717-b392-0ff0c2a9c376
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261105-pwrseq-pcie-m2-uaf-v2-0-3e1dd415af9a@oss.qualcomm.com?part=1


  reply	other threads:[~2026-11-05  8:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  8:28 [PATCH v2 0/2] power: sequencing: fix use-after-free in pwrseq-pcie-m2 Bartosz Golaszewski
2026-11-05  8:28 ` [PATCH v2 1/2] power: sequencing: pcie-m2: fix use-after-free in pwrseq_pcie_m2_vregs_enable() Bartosz Golaszewski
2026-11-05  8:38   ` sashiko-bot [this message]
2026-11-05  8:28 ` [PATCH v2 2/2] power: sequencing: pcie-m2: use devm_mutex_init() Bartosz Golaszewski
2026-11-05  8:39   ` sashiko-bot

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=sashiko-outbox-198730@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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