Re: [PATCH] USB: fix deadlock in HCD code

From: Alan Stern
Date: Wed May 21 2008 - 10:13:56 EST

On Wed, 21 May 2008, Oliver Neukum wrote:

> Am Mittwoch 21 Mai 2008 15:36:49 schrieb Jiri Kosina:
> > On Wed, 21 May 2008, Oliver Neukum wrote:
> >
> > > This turns out not to be the case. Interrupts are disabled.
> >
> > You're right, this callchain can't cause the deadlock indeed. I'll go
> > through the other possibilities.

The functions you are worried about (usb_hcd_link_urb_to_ep and
usb_hcd_unlink_urb_from_ep) are documented as requiring that interrupts
be disabled by their callers. This patch isn't needed.

(Of course, other patches may be needed to insure that the callers do
indeed disable interrupts. But I'm not aware of any such need.)

> usb_hcd_flush_endpoint() is an obvious case.

It's not obvious to me. Where does usb_hcd_flush_endpoint() acquire
hcd_urb_list_lock with interrupts enabled?

> Used in the suspend code.
> Your patch is indeed correct, but I fear there might be a second bug caused
> by wrong calling conditions.

The problem in the Novell bugzilla entry was caused by the fact that
the OHCI irq routine was invoked with interrupts enabled, owing to a
missing IRQF_DISABLED flag. That bug has already been fixed in 2.6.25.

Alan Stern

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at