From: Oliver Neukum <oneukum@suse.com>
To: Tobias Herzog <t-herzog@gmx.de>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org
Subject: Re: [PATCH 2/4] cdc-acm: fix possible invalid access when processing notification
Date: Wed, 15 Mar 2017 10:26:49 +0100 [thread overview]
Message-ID: <1489570009.30434.7.camel@suse.com> (raw)
In-Reply-To: <1489522489-6233-2-git-send-email-t-herzog@gmx.de>
Am Dienstag, den 14.03.2017, 21:14 +0100 schrieb Tobias Herzog:
> Notifications may only be 8 bytes so 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: Tobias Herzog <t-herzog@gmx.de>
> ---
> drivers/usb/class/cdc-acm.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
> index 40714fe..b99127e 100644
> --- a/drivers/usb/class/cdc-acm.c
> +++ b/drivers/usb/class/cdc-acm.c
> @@ -296,6 +296,12 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf)
> break;
>
> case USB_CDC_NOTIFY_SERIAL_STATE:
> + if (dr->wLength != 2) {
Endianness
> + dev_dbg(&acm->control->dev,
> + "%s - malformed serial state\n", __func__);
> + break;
> + }
> +
> newctrl = get_unaligned_le16(data);
>
> if (!acm->clocal && (acm->ctrlin & ~newctrl & ACM_CTRL_DCD)) {
> @@ -332,11 +338,10 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf)
>
> default:
> dev_dbg(&acm->control->dev,
> - "%s - unknown notification %d received: index %d "
> - "len %d data0 %d data1 %d\n",
> + "%s - unknown notification %d received: index %d len %d\n",
> __func__,
> dr->bNotificationType, dr->wIndex,
> - dr->wLength, data[0], data[1]);
> + dr->wLength);
> }
> }
>
next prev parent reply other threads:[~2017-03-15 9:27 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1479118868.21146.4.camel@suse.com>
2017-03-14 20:14 ` [PATCH 1/4] cdc-acm: reassemble fragmented notifications Tobias Herzog
2017-03-14 20:14 ` [PATCH 2/4] cdc-acm: fix possible invalid access when processing notification Tobias Herzog
2017-03-15 9:26 ` Oliver Neukum [this message]
2017-03-14 20:14 ` [PATCH 3/4] cdc-acm: log message for serial state notification Tobias Herzog
2017-03-14 20:14 ` [PATCH 4/4] cdc-acm: remove unused element of struct acm Tobias Herzog
2017-03-15 9:26 ` [PATCH 1/4] cdc-acm: reassemble fragmented notifications Oliver Neukum
2017-03-18 18:52 ` Tobias Herzog
2017-03-18 18:52 ` [PATCH v2 0/4] " Tobias Herzog
2017-03-18 18:52 ` [PATCH v2 1/4] " Tobias Herzog
2017-03-20 15:02 ` Oliver Neukum
2017-03-24 21:50 ` Tobias Herzog
2017-03-28 8:04 ` Oliver Neukum
2017-03-18 18:52 ` [PATCH v2 2/4] cdc-acm: fix possible invalid access when processing notification Tobias Herzog
2017-03-19 9:50 ` Sergei Shtylyov
2017-03-20 15:04 ` Oliver Neukum
2017-03-18 18:52 ` [PATCH v2 3/4] cdc-acm: log message for serial state notification Tobias Herzog
2017-03-18 18:52 ` [PATCH v2 4/4] cdc-acm: remove unused element of struct acm Tobias Herzog
2017-03-30 20:15 ` [PATCH v3 0/4] cdc-acm: reassemble fragmented notifications Tobias Herzog
2017-03-30 20:15 ` [PATCH v3 1/4] cdc-acm: fix possible invalid access when processing notification Tobias Herzog
2017-03-31 9:31 ` Oliver Neukum
2017-03-30 20:15 ` [PATCH v3 2/4] cdc-acm: reassemble fragmented notifications Tobias Herzog
2017-03-31 9:33 ` Oliver Neukum
2017-03-30 20:15 ` [PATCH v3 3/4] cdc-acm: log message for serial state notification Tobias Herzog
2017-03-31 9:34 ` Oliver Neukum
2017-03-30 20:15 ` [PATCH v3 4/4] cdc-acm: remove unused element of struct acm Tobias Herzog
2017-03-31 9:35 ` Oliver Neukum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1489570009.30434.7.camel@suse.com \
--to=oneukum@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=t-herzog@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).