]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.4.39/usb-gadget-udc-core-fix-a-regression-during-gadget-driver-unbinding.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.4.39 / usb-gadget-udc-core-fix-a-regression-during-gadget-driver-unbinding.patch
CommitLineData
77a41081
GKH
1From 511f3c5326eabe1ece35202a404c24c0aeacc246 Mon Sep 17 00:00:00 2001
2From: Alan Stern <stern@rowland.harvard.edu>
3Date: Fri, 15 Mar 2013 14:02:14 -0400
4Subject: usb: gadget: udc-core: fix a regression during gadget driver unbinding
5
6From: Alan Stern <stern@rowland.harvard.edu>
7
8commit 511f3c5326eabe1ece35202a404c24c0aeacc246 upstream.
9
10This patch (as1666) fixes a regression in the UDC core. The core
11takes care of unbinding gadget drivers, and it does the unbinding
12before telling the UDC driver to turn off the controller hardware.
13When the call to the udc_stop callback is made, the gadget no longer
14has a driver. The callback routine should not be invoked with a
15pointer to the old driver; doing so can cause problems (such as
16use-after-free accesses in net2280).
17
18This patch should be applied, with appropriate context changes, to all
19the stable kernels going back to 3.1.
20
21Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
22Signed-off-by: Felipe Balbi <balbi@ti.com>
23Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25
26---
27 drivers/usb/gadget/udc-core.c | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-)
29
30--- a/drivers/usb/gadget/udc-core.c
31+++ b/drivers/usb/gadget/udc-core.c
32@@ -265,7 +265,7 @@ static void usb_gadget_remove_driver(str
33 udc->driver->disconnect(udc->gadget);
34 usb_gadget_disconnect(udc->gadget);
35 udc->driver->unbind(udc->gadget);
36- usb_gadget_udc_stop(udc->gadget, udc->driver);
37+ usb_gadget_udc_stop(udc->gadget, NULL);
38 } else {
39 usb_gadget_stop(udc->gadget, udc->driver);
40 }