From: sashiko-bot@kernel.org
To: "Mathias Nyman" <mathias.nyman@linux.intel.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [[RFT PATCH v2] 1/2] xhci: sideband: avoid use-after-free of stale virt device pointer
Date: Thu, 19 Nov 2026 21:53:44 +0000 [thread overview]
Message-ID: <sashiko-outbox-224111@kernel.org> (raw)
In-Reply-To: <20261119214841.1552318-2-mathias.nyman@linux.intel.com>
> The sideband structure caches vdev, an xhci_virt_device pointer that
> the xhci driver may free and reallocate while the sideband is still
> registered, leaving the sideband with a dangling sb->vdev pointer.
>
> This can happen during resume, either when the xhci driver detects xHC
> power loss and resets the xHC, freeing all virt devices without
> informing class drivers, or during reset-resume when usb core
> re-enumerates the device and xhci frees and allocates a new virt device.
>
> Store the usb_device pointer (udev) instead. It stays valid across
> reset-resume and xHC reset.
> Look up the current virt device and ensure it still points to this
> sideband before using and dereferencing it in sideband API calls.
>
> Make sure xhci_sideband_unregister() works properly when called with
> an invalid vdev. Don't dereference it, or ask the xHC to stop non-existing
> endpoints, but make sure the sideband is properly freed.
> Fail other relevant sideband API calls that would access an invalid
> vdev.
>
> This solution isn't airtight. It only validates vdev when entering
> sideband API functions. It does not serialize the sideband API
> functions against the code in the xhci driver that reallocates vdev,
> so vdev may still be freed in the middle of a sideband call. It's still
> a big improvement and a first step in resolving this.
>
> The following patch starts working on the serialization.
>
> Fixes: de66754e9f80 ("xhci: sideband: add initial api to register a secondary interrupter entity")
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119214841.1552318-1-mathias.nyman@linux.intel.com?part=1
next prev parent reply other threads:[~2026-11-19 21:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 21:48 [[RFT PATCH v2] 0/2] xhci: sideband: fix use-after-free of stale virt device pointer Mathias Nyman
2026-11-19 21:48 ` [[RFT PATCH v2] 1/2] xhci: sideband: avoid " Mathias Nyman
2026-11-19 21:53 ` sashiko-bot [this message]
2026-11-19 21:48 ` [[RFT PATCH v2] 2/2] xhci: sideband: check virt device under xhci lock when stopping endpoints Mathias Nyman
2026-11-19 21:54 ` 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-224111@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--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