Commit 49b4f902 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

USB: fix serial gadget ACM breakage

Two of the CDC ACM control requests in the serial gadget have never
been correct, and have been reported to cause serious troubles ... as
in, soft lockup and maybe watchdog reset (depending on hardware).

This patch makes those request fail cleanly, rather than misbehaving.
Someone using CDC ACM should fix them according to the FIXME comments
which now replace the previous bugs.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 86833691
...@@ -1691,14 +1691,12 @@ static int gs_setup_class(struct usb_gadget *gadget, ...@@ -1691,14 +1691,12 @@ static int gs_setup_class(struct usb_gadget *gadget,
switch (ctrl->bRequest) { switch (ctrl->bRequest) {
case USB_CDC_REQ_SET_LINE_CODING: case USB_CDC_REQ_SET_LINE_CODING:
ret = min(wLength, /* FIXME Submit req to read the data; have its completion
(u16)sizeof(struct usb_cdc_line_coding)); * handler copy that data to port->port_line_coding (iff
if (port) { * it's valid) and maybe pass it on. Until then, fail.
spin_lock(&port->port_lock); */
memcpy(&port->port_line_coding, req->buf, ret); printk(KERN_WARNING "gs_setup: set_line_coding "
spin_unlock(&port->port_lock); "unuspported\n");
}
ret = 0;
break; break;
case USB_CDC_REQ_GET_LINE_CODING: case USB_CDC_REQ_GET_LINE_CODING:
...@@ -1713,11 +1711,18 @@ static int gs_setup_class(struct usb_gadget *gadget, ...@@ -1713,11 +1711,18 @@ static int gs_setup_class(struct usb_gadget *gadget,
break; break;
case USB_CDC_REQ_SET_CONTROL_LINE_STATE: case USB_CDC_REQ_SET_CONTROL_LINE_STATE:
ret = 0; /* FIXME Submit req to read the data; have its completion
* handler use that to set the state (iff it's valid) and
* maybe pass it on. Until then, fail.
*/
printk(KERN_WARNING "gs_setup: set_control_line_state "
"unuspported\n");
break; break;
default: default:
printk(KERN_ERR "gs_setup: unknown class request, type=%02x, request=%02x, value=%04x, index=%04x, length=%d\n", printk(KERN_ERR "gs_setup: unknown class request, "
"type=%02x, request=%02x, value=%04x, "
"index=%04x, length=%d\n",
ctrl->bRequestType, ctrl->bRequest, ctrl->bRequestType, ctrl->bRequest,
wValue, wIndex, wLength); wValue, wIndex, wLength);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment