From: "Neronin, Niklas" <niklas.neronin@linux.intel.com>
To: raoxu <raoxu@uniontech.com>, mathias.nyman@intel.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] usb: xhci: disable the correct slot on alloc_dev failure
Date: Mon, 19 Oct 2026 15:59:26 +0300 [thread overview]
Message-ID: <80a71702-f2aa-47ce-a1e9-15d6884270ce@linux.intel.com> (raw)
In-Reply-To: <6C94F1F35FF16E76+20260806084909.2959131-1-raoxu@uniontech.com>
On 06/08/2026 11.49, raoxu wrote:
> From: Xu Rao <raoxu@uniontech.com>
>
> xhci_alloc_dev() stores the Slot ID returned by the Enable Slot command
> in the local slot_id variable. udev->slot_id is updated only after
> xhci_alloc_virt_device() succeeds.
>
> If endpoint resource reservation or virtual device allocation fails
> before that update, the error path passes udev->slot_id to
> xhci_disable_and_free_slot(). During initial enumeration this is slot 0.
> When reallocating a device whose virtual device is missing or belongs to
> another usb_device, udev->slot_id may contain a stale Slot ID.
> The newly enabled slot can therefore remain active, or the wrong slot can
> be disabled.
>
> Pass slot_id, which identifies the slot enabled by this invocation.
> xhci_disable_and_free_slot() already handles a missing xhci->devs entry.
>
> Fixes: 3ffbba9511b4 ("USB: xhci: Allocate and address USB devices")
> Cc: stable@vger.kernel.org
> Signed-off-by: Xu Rao <raoxu@uniontech.com>
> ---
> drivers/usb/host/xhci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 091c82ca8ee2..dd8c12380e0c 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -4298,7 +4298,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
> return 1;
>
> disable_slot:
> - xhci_disable_and_free_slot(xhci, udev->slot_id);
> + xhci_disable_and_free_slot(xhci, slot_id);
>
> return 0;
> }
> --
> 2.50.1
Reviewed-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Thanks,
Niklas
prev parent reply other threads:[~2026-10-19 12:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 8:49 raoxu
2026-10-19 12:59 ` Neronin, Niklas [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=80a71702-f2aa-47ce-a1e9-15d6884270ce@linux.intel.com \
--to=niklas.neronin@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=raoxu@uniontech.com \
--cc=stable@vger.kernel.org \
/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®