Re: [PATCH] USB: gadget: f_hid: fix deadlock in f_hidg_write()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2019-03-05 at 10:10 +0000, Radoslav Gerganov wrote:
> In f_hidg_write() the write_spinlock is acquired before calling
> usb_ep_queue() which causes a deadlock when dummy_hcd is being used.
> This is because dummy_queue() callbacks into f_hidg_req_complete()
> which tries to acquire the same spinlock. This is (part of) the
> backtrace when the deadlock occurs:
> 
>   0xffffffffc06b1410 in f_hidg_req_complete
>   0xffffffffc06a590a in usb_gadget_giveback_request
>   0xffffffffc06cfff2 in dummy_queue
>   0xffffffffc06a4b96 in usb_ep_queue
>   0xffffffffc06b1eb6 in f_hidg_write
>   0xffffffff8127730b in __vfs_write
>   0xffffffff812774d1 in vfs_write
>   0xffffffff81277725 in SYSC_write
> 
> Fix this by releasing the write_spinlock before calling
> usb_ep_queue()

This fixes a usb_f_hid deadlock I've also been seeing with a FIDO key
emulator.  This is a serious bug in that it brings down my entire
system if I use the hid gadget in any way, so can we please get it
applied?  It turns out to have been introduced by this commit:

commit 749494b6bdbbaf0899aa1c62a1ad74cd747bce47
Author: Krzysztof Opasiak <kopasiak90@xxxxxxxxx>
Date:   Tue Jan 24 03:27:24 2017 +0100

    usb: gadget: f_hid: fix: Move IN request allocation to set_alt()

So you can add

Reviewed-by: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
Tested-by: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx # 4.11+
Fixes: 749494b6bdbb ("usb: gadget: f_hid: fix: Move IN request allocation to set_alt()")

James




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux