[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4BF19517.90301@gmail.com>
Date: Mon, 17 May 2010 21:12:23 +0200
From: Maurus Cuelenaere <mcuelenaere@...il.com>
To: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
CC: David Brownell <dbrownell@...rs.sourceforge.net>,
Greg Kroah-Hartman <gregkh@...e.de>
Subject: [PATCH 1/2] USB: gadget: fix null pointer dereference on non-dual
speed gadgets
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@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists