Commit 16f2c3dd authored by Tobias Herzog's avatar Tobias Herzog Committed by Ben Hutchings

cdc-acm: fix possible invalid access when processing notification

commit 1bb9914e upstream.

Notifications may only be 8 bytes long. Accessing the 9th and
10th byte of unimplemented/unknown notifications may be insecure.
Also check the length of known notifications before accessing anything
behind the 8th byte.
Signed-off-by: default avatarTobias Herzog <t-herzog@gmx.de>
Acked-by: default avatarOliver Neukum <oneukum@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent d3104d98
...@@ -293,6 +293,12 @@ static void acm_ctrl_irq(struct urb *urb) ...@@ -293,6 +293,12 @@ static void acm_ctrl_irq(struct urb *urb)
break; break;
case USB_CDC_NOTIFY_SERIAL_STATE: case USB_CDC_NOTIFY_SERIAL_STATE:
if (le16_to_cpu(dr->wLength) != 2) {
dev_dbg(&acm->control->dev,
"%s - malformed serial state\n", __func__);
break;
}
tty = tty_port_tty_get(&acm->port); tty = tty_port_tty_get(&acm->port);
newctrl = get_unaligned_le16(data); newctrl = get_unaligned_le16(data);
...@@ -323,11 +329,10 @@ static void acm_ctrl_irq(struct urb *urb) ...@@ -323,11 +329,10 @@ static void acm_ctrl_irq(struct urb *urb)
default: default:
dev_dbg(&acm->control->dev, dev_dbg(&acm->control->dev,
"%s - unknown notification %d received: index %d " "%s - unknown notification %d received: index %d len %d\n",
"len %d data0 %d data1 %d\n",
__func__, __func__,
dr->bNotificationType, dr->wIndex, dr->bNotificationType, dr->wIndex, dr->wLength);
dr->wLength, data[0], data[1]);
break; break;
} }
exit: exit:
......
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