USB: EHCI: Unlink the pending async queue heads explicitly in ehci_stop
Is is observed that ehci->async->qh_next ptr is not getting freed up
which is causing crash in ehci_mem_cleanup function. As a temporary
workaround unlink the pending queue heads as a part of ehci_stop.
CRs-fixed: 301134
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 8e6ef28..0744395 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -527,8 +527,21 @@
/* root hub is shut down separately (first, when possible) */
spin_lock_irq (&ehci->lock);
- if (ehci->async)
+ if (ehci->async) {
+ /*
+ * TODO: Observed that ehci->async next ptr is not
+ * NULL sometimes which leads to crash in mem_cleanup.
+ * Root cause is not yet known why this messup is
+ * happenning.
+ * The follwing workaround fixes the crash caused
+ * by this temporarily.
+ * check if async next ptr is not NULL and unlink
+ * explictly.
+ */
+ if (ehci->async->qh_next.ptr != NULL)
+ start_unlink_async(ehci, ehci->async->qh_next.qh);
ehci_work (ehci);
+ }
spin_unlock_irq (&ehci->lock);
ehci_mem_cleanup (ehci);