# Re: \[PATCH\] hid: usbhid: fix possible deadlock in \_\_usbhid\_submit\_report

- From: Alan Stern \<stern@rowland.harvard.edu\>
- Date: 2012-04-21 17:31:21 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2012/04/8919323
- Thread: https://ratatoskr.run/linux-input/2012/04/8919321/t.md

```text
On Sat, 21 Apr 2012, Ming Lei wrote:

> >> Think about what happens if the URB being unlinked hasn't been
> >> presented to the hardware yet. �Once it has been removed from the HCD's
> >> internal lists, there's no reason not to give it back right away. �And
> >> there's no natural time to give it back later.
> >
> > Now. The question is not when, but from which context.
> > The context should be uniform, so that the requirements
> > for locking should also be uniform.
> 
> How about always scheduling a tasklet to run what usb_unlink_urb does?
> just implement usb_unlink_urb as something like
> tasklet_schedule(unlink_tasklet).
> 
> Then we can have a uniform lock requirement and no changes are involved
> on host controller drivers.

The return values would not be correct.

On the other hand, usbnet could call usb_unlink_urb from within a 
tasklet.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
```
