On Wed, 29 Oct 2003, Greg KH wrote:
> On Wed, Oct 29, 2003 at 04:01:06PM -0500, Alan Stern wrote:
> > This patch should fix the problem reported below by Daniel Dorau. The
> > oops was caused by inadequate synchronization between khubd and
> > hub_disconnect(). The hub interface-data pointer was reset by the
> > disconnect routine while khubd was still using it. The revised code
> > doesn't erase the pointer until after khubd has terminated.
> >
> > The patch also improves the synchronization with hub_irq(). The current
> > code could, under the proper race conditions, resubmit the hub URB during
> > an rmmod. Alternatively, it could unlink the URB but then exit and unload
> > before the callback routine had run. Proper use of a struct completion
> > and an urb_active flag will prevent either of those errors.
> >
> > Finally, the patch changes spin_lock_save() to spin_lock() within
> > the completion routine (which always runs with local interrupts disabled)
> > and replaces a couple of list_del()/INIT_LIST_HEAD() sequences with
> > list_del_init().
>
> Hm, looks like this patch does 3 different things, right? Care to send
> 3 different patches? :)
No problem. Here's the first one. This patch fixes Daniel's problem.
The interface-data pointer isn't cleared until the khubd thread has
terminated. I recommend that this patch be applied now.
Alan Stern
===== hub.c 1.123 vs edited =====
--- 1.123/drivers/usb/core/hub.c Mon Sep 22 12:37:50 2003
+++ edited/drivers/usb/core/hub.c Fri Oct 31 13:36:17 2003
@@ -490,7 +490,6 @@
if (!hub)
return;
- usb_set_intfdata (intf, NULL);
spin_lock_irqsave(&hub_event_lock, flags);
/* Delete it and then reset it */
@@ -530,6 +529,8 @@
hub->buffer_dma);
hub->buffer = NULL;
}
+
+ usb_set_intfdata (intf, NULL);
/* Free the memory */
kfree(hub);
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel