提交 feca7746 编写于 作者: A Alan Stern 提交者: Greg Kroah-Hartman

USB: EHCI: don't check DMA values in QH overlays

This patch (as1661) fixes a rather obscure bug in ehci-hcd.  In a
couple of places, the driver compares the DMA address stored in a QH's
overlay region with the address of a particular qTD, in order to see
whether that qTD is the one currently being processed by the hardware.
(If it is then the status in the QH's overlay region is more
up-to-date than the status in the qTD, and if it isn't then the
overlay's value needs to be adjusted when the QH is added back to the
active schedule.)

However, DMA address in the overlay region isn't always valid.  It
sometimes will contain a stale value, which may happen by coincidence
to be equal to a qTD's DMA address.  Instead of checking the DMA
address, we should check whether the overlay region is active and
valid.  The patch tests the ACTIVE bit in the overlay, and clears this
bit when the overlay becomes invalid (which happens when the
currently-executing URB is unlinked).

This is the second part of a fix for the regression reported at:

	https://bugs.launchpad.net/bugs/1088733Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
Reported-by: NJoseph Salisbury <joseph.salisbury@canonical.com>
Reported-and-tested-by: NStephen Thirlwall <sdt@dr.com>
CC: <stable@vger.kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 6402c796
...@@ -135,7 +135,7 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -135,7 +135,7 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh)
* qtd is updated in qh_completions(). Update the QH * qtd is updated in qh_completions(). Update the QH
* overlay here. * overlay here.
*/ */
if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current) { if (qh->hw->hw_token & ACTIVE_BIT(ehci)) {
qh->hw->hw_qtd_next = qtd->hw_next; qh->hw->hw_qtd_next = qtd->hw_next;
qtd = NULL; qtd = NULL;
} }
...@@ -449,11 +449,19 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -449,11 +449,19 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
else if (last_status == -EINPROGRESS && !urb->unlinked) else if (last_status == -EINPROGRESS && !urb->unlinked)
continue; continue;
/* qh unlinked; token in overlay may be most current */ /*
if (state == QH_STATE_IDLE * If this was the active qtd when the qh was unlinked
&& cpu_to_hc32(ehci, qtd->qtd_dma) * and the overlay's token is active, then the overlay
== hw->hw_current) { * hasn't been written back to the qtd yet so use its
* token instead of the qtd's. After the qtd is
* processed and removed, the overlay won't be valid
* any more.
*/
if (state == QH_STATE_IDLE &&
qh->qtd_list.next == &qtd->qtd_list &&
(hw->hw_token & ACTIVE_BIT(ehci))) {
token = hc32_to_cpu(ehci, hw->hw_token); token = hc32_to_cpu(ehci, hw->hw_token);
hw->hw_token &= ~ACTIVE_BIT(ehci);
/* An unlink may leave an incomplete /* An unlink may leave an incomplete
* async transaction in the TT buffer. * async transaction in the TT buffer.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册