All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Linux USB <linux-usb@vger.kernel.org>, Tuba Yavuz <tuba@ece.ufl.edu>
Subject: [2/2] usb: dwc3: gadget: never call ->complete() from ->ep_queue()
Date: Mon, 26 Mar 2018 13:23:43 +0200	[thread overview]
Message-ID: <20180326112343.GA23854@kroah.com> (raw)

On Mon, Mar 26, 2018 at 01:14:47PM +0300, Felipe Balbi wrote:
> This is a requirement which has always existed but, somehow, wasn't
> reflected in the documentation and problems weren't found until now
> when Tuba Yavuz found a possible deadlock happening between dwc3 and
> f_hid. She described the situation as follows:
> 
> 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);
> 	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
> 
> Note that this happens because dwc3 would call ->complete() on a
> failed usb_ep_queue() due to failed Start Transfer command. This is,
> anyway, a theoretical situation because dwc3 currently uses "No
> Response Update Transfer" command for Bulk and Interrupt endpoints.
> 
> It's still good to make this case impossible to happen even if the "No
> Reponse Update Transfer" command is changed.
> 
> Reported-by: Tuba Yavuz <tuba@ece.ufl.edu>
> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
> Cc: stable <stable@vger.kernel.org>
> ---
> 
> Greg, if you want to pick these two patches as they are, please go
> ahead. If you want, I can also add a Cc stable tag, your call.

I've added the stable tag and applied both of these patches now.

thanks,

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

             reply	other threads:[~2018-03-26 11:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26 11:23 Greg Kroah-Hartman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-03-26 10:14 [2/2] usb: dwc3: gadget: never call ->complete() from ->ep_queue() Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180326112343.GA23854@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=felipe.balbi@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=tuba@ece.ufl.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.