From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com ([134.134.136.65]:59752 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753934AbdC1GuS (ORCPT ); Tue, 28 Mar 2017 02:50:18 -0400 From: Felipe Balbi To: Mathias Nyman , gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 3/3] xhci: Manually give back cancelled URB if queuing it for cancel fails In-Reply-To: <58D92DA0.4040808@linux.intel.com> References: <1490624830-9761-1-git-send-email-mathias.nyman@linux.intel.com> <1490624830-9761-4-git-send-email-mathias.nyman@linux.intel.com> <874lyekbwg.fsf@linux.intel.com> <58D92DA0.4040808@linux.intel.com> Date: Tue, 28 Mar 2017 09:49:07 +0300 Message-ID: <87y3vpj3q4.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: stable-owner@vger.kernel.org List-ID: Hi, Mathias Nyman writes: > On 27.03.2017 17:54, Felipe Balbi wrote: >> >> Hi, >> >> Mathias Nyman writes: >>> Manually give back URB if we are can not add it to the cancel queue, and >>> stop the endpoint normally. >> >> this sentence doesn't parse very well ;-) >> >>> This can happen if device just reset before URB timed out and dequeued, >>> leading to missing endpoint ring. >> >> seems like this could be extended a bit too. >> >>> @@ -1554,6 +1553,14 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) >>> done: >>> spin_unlock_irqrestore(&xhci->lock, flags); >>> return ret; >>> + >>> +err_giveback: >>> + if (urb_priv) >>> + xhci_urb_free_priv(urb_priv); >>> + usb_hcd_unlink_urb_from_ep(hcd, urb); >> >> well, aren't you introducing another regression here? >> >> if the return status from usb_hcd_check_unlink_urb() is -EBUSY, then, >> perhaps, you really shouldn't give it back now. > > I'm not giving it back in that case, it works as it should: > > > ret = usb_hcd_check_unlink_urb(hcd, urb, status); > if (ret) > goto done; > ... > done: > spin_unlock_irqrestore(&xhci->lock, flags); > return ret; oh, right. I got confused with the goto labels -- balbi