diff mbox

[Bugme-new,Bug,14564] New: capture-example sleeping function called from invalid context at arch/x86/mm/fault.c

Message ID Pine.LNX.4.44L0.1001041538140.3180-100000@iolanthe.rowland.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Alan Stern Jan. 4, 2010, 8:48 p.m. UTC
None
diff mbox

Patch

Index: usb-2.6/drivers/usb/host/ohci-q.c
===================================================================
--- usb-2.6.orig/drivers/usb/host/ohci-q.c
+++ usb-2.6/drivers/usb/host/ohci-q.c
@@ -505,6 +505,7 @@  td_fill (struct ohci_hcd *ohci, u32 info
 	struct urb_priv		*urb_priv = urb->hcpriv;
 	int			is_iso = info & TD_ISO;
 	int			hash;
+	volatile struct td	* volatile td1, * volatile td2;
 
 	// ASSERT (index < urb_priv->length);
 
@@ -558,11 +559,30 @@  td_fill (struct ohci_hcd *ohci, u32 info
 
 	/* hash it for later reverse mapping */
 	hash = TD_HASH_FUNC (td->td_dma);
+
+	td1 = ohci->td_hash[hash];
+	td2 = NULL;
+	if (td1) {
+		td2 = td1->td_hash;
+		if (td2 == td1 || td2 == td) {
+			ohci_err(ohci, "Circular hash: %d %p %p %p\n",
+					hash, td1, td2, td);
+			td2 = td1->td_hash = NULL;
+		}
+	}
+
 	td->td_hash = ohci->td_hash [hash];
 	ohci->td_hash [hash] = td;
 
 	/* HC might read the TD (or cachelines) right away ... */
 	wmb ();
+
+	if (td1 && td1->td_hash != td2) {
+		ohci_err(ohci, "Hash value changed: %d %p %p %p\n",
+					hash, td1, td2, td);
+		td1->td_hash = (struct td *) td2;
+	}
+
 	td->ed->hwTailP = td->hwNextTD;
 }