From: Greg KH <gregkh@linuxfoundation.org>
To: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Cc: mathias.nyman@intel.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, WeitaoWang@zhaoxin.com,
wwt8723@163.com, CobeChen@zhaoxin.com
Subject: Re: [PATCH] usb:xhci:Fix slot_id resource race conflict
Date: Thu, 24 Jul 2025 08:36:48 +0200 [thread overview]
Message-ID: <2025072425-sixtyfold-curling-88ff@gregkh> (raw)
In-Reply-To: <20250724124012.296934-1-WeitaoWang-oc@zhaoxin.com>
On Thu, Jul 24, 2025 at 08:40:12PM +0800, Weitao Wang wrote:
> @@ -4085,10 +4086,11 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
> for (i = 0; i < 31; i++)
> virt_dev->eps[i].ep_state &= ~EP_STOP_CMD_PENDING;
> virt_dev->udev = NULL;
> - xhci_disable_slot(xhci, udev->slot_id);
> + ret = xhci_disable_slot(xhci, udev->slot_id);
>
> spin_lock_irqsave(&xhci->lock, flags);
> - xhci_free_virt_device(xhci, udev->slot_id);
> + if (ret)
> + xhci_free_virt_device(xhci, udev->slot_id);
> spin_unlock_irqrestore(&xhci->lock, flags);
Shouldn't you lock/unlock only if ret is set?
thanks,
greg k-h
next prev parent reply other threads:[~2025-07-24 6:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 12:40 [PATCH] usb:xhci:Fix slot_id resource race conflict Weitao Wang
2025-07-24 6:35 ` Greg KH
2025-07-24 15:30 ` WeitaoWang-oc
2025-07-24 6:36 ` Greg KH [this message]
2025-07-24 15:24 ` WeitaoWang-oc
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=2025072425-sixtyfold-curling-88ff@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=CobeChen@zhaoxin.com \
--cc=WeitaoWang-oc@zhaoxin.com \
--cc=WeitaoWang@zhaoxin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=wwt8723@163.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