]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: gadget: udc-core: fix a regression during gadget driver unbinding
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 15 Mar 2013 18:02:14 +0000 (14:02 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Apr 2013 16:26:05 +0000 (09:26 -0700)
commit 511f3c5326eabe1ece35202a404c24c0aeacc246 upstream.

This patch (as1666) fixes a regression in the UDC core.  The core
takes care of unbinding gadget drivers, and it does the unbinding
before telling the UDC driver to turn off the controller hardware.
When the call to the udc_stop callback is made, the gadget no longer
has a driver.  The callback routine should not be invoked with a
pointer to the old driver; doing so can cause problems (such as
use-after-free accesses in net2280).

This patch should be applied, with appropriate context changes, to all
the stable kernels going back to 3.1.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc-core.c

index 4d90a800063ce93a66a2486f95bfd1273c348d7d..34a39076d3b05c2d26eb86cd94c6f6e1c35ba407 100644 (file)
@@ -265,7 +265,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
                usb_gadget_disconnect(udc->gadget);
                udc->driver->disconnect(udc->gadget);
                udc->driver->unbind(udc->gadget);
-               usb_gadget_udc_stop(udc->gadget, udc->driver);
+               usb_gadget_udc_stop(udc->gadget, NULL);
        } else {
                usb_gadget_stop(udc->gadget, udc->driver);
        }