[PATCH] Possible bug in drivers/usb/gadget/at91_udc.c

Patrik Sevallius <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
I'm having problem with oopses when rebooting, if I modprobe g_serial
and then rmmod g_serial and do a reboot i get an oops in
device_shutdown(). The reason seems to be that
usb_gadget_unregister_driver() doesn't do enough cleanup. 

device_shutdown() finds a non-NULL address for dev->driver (which points
to the address of the unloaded g_serial module) and tries to access
dev->driver->shutdown which results in a "Unable to handle kernel paging
request at virtual address ".

With the following patch i don't get the oops:

Signed-off-by: Patrik Sevallius <[email protected]>

--- drivers/usb/gadget/at91_udc.c.orig  2007-11-08 08:27:28.591679637
+0100
+++ drivers/usb/gadget/at91_udc.c       2007-11-08 08:27:36.725639902
+0100
@@ -1614,6 +1614,8 @@ int usb_gadget_unregister_driver (struct
        local_irq_enable();

        driver->unbind(&udc->gadget);
+       udc->gadget.dev.driver = NULL;
+       udc->gadget.dev.driver_data = NULL;
        udc->driver = NULL;

        DBG("unbound from %s\n", driver->driver.name);


I'm not sure if this fix is the correct way to solve the problem, or if
this even is the correct way to send the patch (since this is the first
time I've submitted a patch).


/Patrik Sevallius

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.