summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Goby <benoit@android.com>2011-11-29 13:49:27 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:39:19 -0800
commit7f9ed524778bcdcd8a51bdeab2095655fb57c431 (patch)
treed0f3dded06581affa19ee3f003d6e4c3542ea4e8
parent1bac6490fc2e5147abd4b702b172edd6a4dfc077 (diff)
usb: gadget: android: Cancel pending ctrlrequest before disabling
Make sure there is no pending ctrlrequest before removing the config. Otherwise the ctrlrequest complete callback could access structures after they have been freed. Unbind cancels pending transfers but not ep0 requests. Bug: 5513065 5440193 Change-Id: I063c22bf5d104a3d2df71cf622409459fac5f27a Signed-off-by: Benoit Goby <benoit@android.com>
-rw-r--r--drivers/usb/gadget/android.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index 5d77899678f9..2b7631052ea7 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -837,6 +837,8 @@ static ssize_t enable_store(struct device *pdev, struct device_attribute *attr,
dev->enabled = true;
} else if (!enabled && dev->enabled) {
usb_gadget_disconnect(cdev->gadget);
+ /* Cancel pending control requests */
+ usb_ep_dequeue(cdev->gadget->ep0, cdev->req);
usb_remove_config(cdev, &android_config_driver);
dev->enabled = false;
} else {