[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025072425-sixtyfold-curling-88ff@gregkh>
Date: Thu, 24 Jul 2025 08:36:48 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Weitao Wang <WeitaoWang-oc@...oxin.com>
Cc: mathias.nyman@...el.com, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, WeitaoWang@...oxin.com,
wwt8723@....com, CobeChen@...oxin.com
Subject: Re: [PATCH] usb:xhci:Fix slot_id resource race conflict
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
Powered by blists - more mailing lists