[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c52e3bc8-3618-cc99-a936-6576fef3215b@zhaoxin.com>
Date: Thu, 24 Jul 2025 23:24:10 +0800
From: "WeitaoWang-oc@...oxin.com" <WeitaoWang-oc@...oxin.com>
To: Greg KH <gregkh@...uxfoundation.org>
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 2025/7/24 14:36, Greg KH wrote:
>
>
> [这封邮件来自外部发件人 谨防风险]
>
> 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?
Yes,it's my mistake,here's code should like this:
ret = xhci_disable_slot(xhci, udev->slot_id);
if (ret) {
spin_lock_irqsave(&xhci->lock, flags);
xhci_free_virt_device(xhci, udev->slot_id);
spin_unlock_irqrestore(&xhci->lock, flags);
}
Thanks for your suggestion. I'll revise it in the next patch version.
Best Regards,
weitao
> greg k-h
> .
Powered by blists - more mailing lists