From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com ([192.55.52.43]:43882 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752536AbdC0O7P (ORCPT ); Mon, 27 Mar 2017 10:59:15 -0400 From: Felipe Balbi To: Mathias Nyman , gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, Mathias Nyman , 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: <874lyekbwg.fsf@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> Date: Mon, 27 Mar 2017 17:57:37 +0300 Message-ID: <871stikbry.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: stable-owner@vger.kernel.org List-ID: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Felipe Balbi writes: > 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. not to mention the following excerpt from usb_hcd_check_unlink_urb() kdoc: * Return: 0 for no error, otherwise a negative error code (in which case * the dequeue() method must fail). The possible error codes are: * * -EIDRM: @urb was not submitted or has already completed. * The completion function may not have been called yet. * * -EBUSY: @urb has already been unlinked. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAljZKGEACgkQzL64meEa mQZfERAAzbmYgFP7b3tagckPZIPkme+FKWkcnoQSx1IbV5wQ8NoqF6v1pEUKe0+y SmTSjd3nRpQt8B0ulNT23g3lW2RgUe+xnSGY+ViS5tlojBFXlu9IR/0eu/JuDttl yjxJ0jaNHvEjARYQDyUt4yqmrWWVOd7BDzD6S3QIQ2MO31Ht/iE0iDA+81sUQH5W 6zo5U+XFYMsQEDabadynT4Tan97azRV/GRtWehZGtfQHOtqTM2bA7ogng17j5xNy x9lVlvgYpv8tgIsQbMsOYm14pS+z2iMtvHQWmzT4vaPoeBxPUrna/ZOV7F+4kBTJ 6FNerHjMPA96ehXOIVGq9i6PEiLZkaTK0HG+7a0D2cFj3A88LsOSX1xTRvoG6o7B HmW/FYzS9qW2qSIrOLIQgxAcUTBl4ZYKYJmf4NqhbdobgXuhkWU7SN++8izjf30Y /APuKskGSj5/ll7/w2AGE8iKPUswBNPUAc/UopHGpZIL6SOq4b/IzXmHIwbRdsw9 n5fLV4Vf74hi7dK/ioF9tgG/D2n04EJR/5eNmiy2jfRs/t8d8tgPwu++GXGONsrx rTdAfK4cBC2mtqhVTen7+231gm0w+9u1+sbU1vyce3+q/7VWXlRhL8p9eZumJAN+ Kiep+KjrKFCa3JJIcVkb4D1pSWfjFIyDlTCfox0g8t9xYRxTpPg= =5wbI -----END PGP SIGNATURE----- --=-=-=--