1. 21 5月, 2018 35 次提交
  2. 26 3月, 2018 1 次提交
    • F
      usb: dwc3: gadget: never call ->complete() from ->ep_queue() · c91815b5
      Felipe Balbi 提交于
      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: NTuba Yavuz <tuba@ece.ufl.edu>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c91815b5
  3. 22 3月, 2018 3 次提交
  4. 13 3月, 2018 1 次提交
    • R
      usb: dwc3: Prevent indefinite sleep in _dwc3_set_mode during suspend/resume · 498f0478
      Roger Quadros 提交于
      In the following test we get stuck by sleeping forever in _dwc3_set_mode()
      after which dual-role switching doesn't work.
      
      On dra7-evm's dual-role port,
      - Load g_zero gadget driver and enumerate to host
      - suspend to mem
      - disconnect USB cable to host and connect otg cable with Pen drive in it.
      - resume system
      - we sleep indefinitely in _dwc3_set_mode due to.
        dwc3_gadget_exit()->usb_del_gadget_udc()->udc_stop()->
      	dwc3_gadget_stop()->wait_event_lock_irq()
      
      To fix this instead of waiting indefinitely with wait_event_lock_irq()
      we use wait_event_interruptible_lock_irq_timeout() and print
      and error message if there was a timeout.
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      498f0478