From 5d938924f9bc39b9b93039091dc63443c25f6bb3 Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Tue, 9 Jun 2020 22:54:48 -0700 Subject: [PATCH] usb: xhci: Don't check for USB_STATE_NOTATTACHED in xhci_stop_endpoint This API can be called by the QMI sound driver precisely when a device is disconnected in order to issue a stop endpoint command to properly halt the transfer ring. With this check the function silently bails, so the XHCI controller hardware may continue to be accessing the buffers on the transfer ring; meanwhile the QMI sound driver proceeds to unmap the buffers from DMA resulting in an SMMU fault. Remove the check to allow the endpoint to be properly stopped. Change-Id: I80315c31d9b1685ac4375c1da051a8e22cab07ca Signed-off-by: Jack Pham --- drivers/usb/host/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 1176b001e3dd..8b9a39eddf40 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -5390,7 +5390,7 @@ int xhci_stop_endpoint(struct usb_device *udev, struct usb_host_endpoint *ep) unsigned long flags; int ret = 0; - if (udev->state == USB_STATE_NOTATTACHED || !HCD_RH_RUNNING(hcd)) + if (!HCD_RH_RUNNING(hcd)) return 0; cmd = xhci_alloc_command(xhci, true, GFP_NOIO);