The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [30/82] usb gadget: composite: prevent OOPS for non-standard control request
@ 2010-11-19 21:55 Greg KH
  0 siblings, 0 replies; only message in thread
From: Greg KH @ 2010-11-19 21:55 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: stable-review, torvalds, akpm, alan, Roger Quadros,
	David Brownell, Michal Nazarewicz, Robert Lukassen, Kyungmin Park

2.6.35-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Roger Quadros <roger.quadros@nokia.com>

commit 5c836e4d583701a5eecb288b5f131da39115f5ec upstream.

The composite gadget will OOPS if the host sends a control request
targetted to an interface of an un-configured composite device. This patch
prevents this.

The OOPS was observed during WHQL USB CV tests. With this patch, the device
STALLs as per requirement.

Failing test case: From host do the following. I used libusb-1.0

1) Set configuration to zero.
	libusb_control_transfer(device_handle,
		0, /* standard OUT */
		0x9, /* setConfiguration */
		0, 0, NULL, 0, 0);

2) Query current configuratioan.
	libusb_control_transfer(device_handle,
		0x80, /* standard IN*/
		0x8, /* getConfiguration */
		0, 0, data, 1, 0);

3) Send the non-standard ctrl transfer targetted to interface
	libusb_control_transfer(device_handle,
		0x81, /* standard IN to interface*/
		0x6, /* getDescriptor */
		0x2300, 0, data, 0x12, 0);

Signed-off-by: Roger Quadros <roger.quadros@nokia.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: Robert Lukassen <robert.lukassen@tomtom.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/usb/gadget/composite.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -838,7 +838,8 @@ unknown:
 		 */
 		switch (ctrl->bRequestType & USB_RECIP_MASK) {
 		case USB_RECIP_INTERFACE:
-			f = cdev->config->interface[intf];
+			if (cdev->config)
+				f = cdev->config->interface[intf];
 			break;
 
 		case USB_RECIP_ENDPOINT:



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

only message in thread, other threads:[~2010-11-19 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-19 21:55 [30/82] usb gadget: composite: prevent OOPS for non-standard control request Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox