On Tue, Oct 24, 2017 at 09:16:19AM -0700, Jack Pham wrote: > From: Mayank Rana <mrana@xxxxxxxxxxxxxx> > > commit b3207c65dfafae27e7c492cb9188c0dc0eeaf3fd upstream. > > 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,") > Signed-off-by: Mayank Rana <mrana@xxxxxxxxxxxxxx> > Signed-off-by: Jack Pham <jackp@xxxxxxxxxxxxxx> > Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> > --- > Hi Greg, > > I tested that this applies cleanly to 3.18.y, 4.4.y and 4.9.y. Thanks for the patch, now queued up. greg k-h