All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] USB: gadget: fix null pointer dereference on non-dual speed gadgets
@ 2010-05-17 19:12 Maurus Cuelenaere
  0 siblings, 0 replies; only message in thread
From: Maurus Cuelenaere @ 2010-05-17 19:12 UTC (permalink / raw)
  To: linux-usb, linux-kernel; +Cc: David Brownell, Greg Kroah-Hartman

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@gmail.com>
---
 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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-17 19:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-17 19:12 [PATCH 1/2] USB: gadget: fix null pointer dereference on non-dual speed gadgets Maurus Cuelenaere

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.