Possible deadlock due to double spinlock in /drivers/usb/gadget/function/f_hid

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

 



For some reason, Tuba can't seem to post to linux-usb@vger, so I'm
forwarding on his message below.

Felipe, sorry if you have seen this 3+ times already :(

thanks,

greg k-h

On Fri, Mar 23, 2018 at 01:05:28PM +0000, Yavuz, Tuba wrote:
> 
> Hello,
> 
> It looks like there is a deadlock possibility due to double locking of a spinlock in the f_hidg_write function of the f_hid driver.
> 
>        spin_lock_irqsave(&hidg->write_spinlock, flags); // first acquire
> 
>         /* we our function has been disabled by host */
>         if (!hidg->req) {
>                 free_ep_req(hidg->in_ep, hidg->req);
>                 /*
>                  * TODO
>                  * Should we fail with error here?
>                  */
>                 goto try_again;
>         }
> 
>         ...
> 
>         status = usb_ep_queue(hidg->in_ep, hidg->req, GFP_ATOMIC);
>         =>
>           ...
>              => usb_gadget_giveback_request
>                      =>
>                          f_hidg_req_complete          
>                             =>
>                               spin_lock_irqsave(&hidg->write_spinlock, flags); // second acquire 
> 
> The bug was introduced with commit 749494b6bdbbaf0899aa1c62a1ad74cd747bce47.
> 
> 
> Tuba Yavuz, Ph.D.
> Assistant Professor
> Electrical and Computer Engineering Department
> University of Florida
> Gainesville, FL 32611
> Webpage: http://www.tuba.ece.ufl.edu/
> Email: tuba@xxxxxxxxxxx
> Phone: (352) 846 0202
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

  Powered by Linux