From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:58320 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932471AbdJXKWa (ORCPT ); Tue, 24 Oct 2017 06:22:30 -0400 Date: Tue, 24 Oct 2017 12:22:37 +0200 From: Greg KH To: Jack Pham Cc: mrana@codeaurora.org, mathias.nyman@linux.intel.com, stable@vger.kernel.org Subject: Re: FAILED: patch "[PATCH] usb: xhci: Handle error condition in xhci_stop_device()" failed to apply to 4.9-stable tree Message-ID: <20171024102237.GA7323@kroah.com> References: <15087631701428@kroah.com> <20171024011350.GA31722@usblab-sd-06.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171024011350.GA31722@usblab-sd-06.qualcomm.com> Sender: stable-owner@vger.kernel.org List-ID: On Mon, Oct 23, 2017 at 06:13:50PM -0700, Jack Pham wrote: > Hi Greg, > > On Mon, Oct 23, 2017 at 02:52:50PM +0200, gregkh@linuxfoundation.org wrote: > > > > The patch below does not apply to the 4.9-stable tree. > > If someone wants it applied there, or to any other stable or longterm > > tree, then please email the backport, including the original git commit > > id to . > > It appears to be a trivial conflict. See below. > > > ------------------ original commit in Linus's tree ------------------ > > > > From b3207c65dfafae27e7c492cb9188c0dc0eeaf3fd Mon Sep 17 00:00:00 2001 > > From: Mayank Rana > > Date: Fri, 6 Oct 2017 17:45:30 +0300 > > Subject: [PATCH] usb: xhci: Handle error condition in xhci_stop_device() > > > > xhci_stop_device() calls xhci_queue_stop_endpoint() multiple times > > without checking the return value. xhci_queue_stop_endpoint() can > > return error if the HC is already halted or unable to queue commands. > > This can cause a deadlock condition as xhci_stop_device() would > > end up waiting indefinitely for a completion for the command that > > didn't get queued. Fix this by checking the return value and bailing > > out of xhci_stop_device() in case of error. This patch happens to fix > > potential memory leaks of the allocated command structures as well. > > > > Fixes: c311e391a7ef ("xhci: rework command timeout and cancellation,") > > Cc: > > Signed-off-by: Mayank Rana > > Signed-off-by: Jack Pham > > Signed-off-by: Mathias Nyman > > Signed-off-by: Greg Kroah-Hartman > > > > diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c > > index da9158f171cb..a2336deb5e36 100644 > > --- a/drivers/usb/host/xhci-hub.c > > +++ b/drivers/usb/host/xhci-hub.c > > @@ -420,14 +420,25 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) > > GFP_NOWAIT); > > if (!command) { > > spin_unlock_irqrestore(&xhci->lock, flags); > > - xhci_free_command(xhci, cmd); > > - return -ENOMEM; > > The conflict appears to be here. There was an extra blank line after > this that had been removed by another patch in 4.13. So when applying to > the older stable trees which still has the blank line I guess git > couldn't resolve it. > > Is this enough info for you to fix up or would you need me to send a > revised backport patch? If I send, would I need to add my S-o-b again > after the other tags? I need a new patch please, that makes it the easiest for me to ensure I got it right :) And if you want to add a new s-o-b, that's fine as well, but not needed. thanks, greg k-h