[PATCH 1/2] USB: gadget: fix null pointer dereference on non-dualspeed gadgets
From: Maurus Cuelenaere
Date: Mon May 17 2010 - 15:12:32 EST
The composite driver doesn't verify whether gadgets are dual speed when using
the high speed descriptors.
USB drivers don't set usb_function->hs_descriptors on non-dual speed gadgets,
which result in dereferencing a NULL pointer in set_config().
Signed-off-by: Maurus Cuelenaere <mcuelenaere@xxxxxxxxx>
---
drivers/usb/gadget/composite.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 09289bb..fa07267 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -431,7 +431,8 @@ static int set_config(struct usb_composite_dev *cdev,
* function's setup callback instead of the current
* configuration's setup callback.
*/
- if (gadget->speed == USB_SPEED_HIGH)
+ if (gadget->speed == USB_SPEED_HIGH
+ && gadget_is_dualspeed(gadget))
descriptors = f->hs_descriptors;
else
descriptors = f->descriptors;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/