stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: baolu.lu@linux.intel.com
Cc: Oliver Neukum <oneukum@suse.com>, stable@vger.kernel.org
Subject: [PATCH 02/10] USB: cdc-acm: more sanity checking
Date: Fri, 25 Mar 2016 10:58:58 +0800	[thread overview]
Message-ID: <1458874746-958-2-git-send-email-baolu.lu@linux.intel.com> (raw)
In-Reply-To: <1458874746-958-1-git-send-email-baolu.lu@linux.intel.com>

From: Oliver Neukum <oneukum@suse.com>

An attack has become available which pretends to be a quirky
device circumventing normal sanity checks and crashes the kernel
by an insufficient number of interfaces. This patch adds a check
to the code path for quirky devices.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/class/cdc-acm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 1d2c99a..83fd30b 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1179,6 +1179,9 @@ static int acm_probe(struct usb_interface *intf,
 	if (quirks == NO_UNION_NORMAL) {
 		data_interface = usb_ifnum_to_if(usb_dev, 1);
 		control_interface = usb_ifnum_to_if(usb_dev, 0);
+		/* we would crash */
+		if (!data_interface || !control_interface)
+			return -ENODEV;
 		goto skip_normal_probe;
 	}
 
-- 
2.1.4


  reply	other threads:[~2016-03-25  2:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-25  2:58 [PATCH 01/10] USB: usb_driver_claim_interface: add sanity checking Lu Baolu
2016-03-25  2:58 ` Lu Baolu [this message]
2016-03-25  3:03   ` [PATCH 02/10] USB: cdc-acm: more " Lu Baolu
2016-03-25  2:58 ` [PATCH 03/10] USB: uas: Reduce can_queue to MAX_CMNDS Lu Baolu
2016-03-25  3:03   ` Lu Baolu
2016-03-25  3:02 ` [PATCH 01/10] USB: usb_driver_claim_interface: add sanity checking Lu Baolu

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=1458874746-958-2-git-send-email-baolu.lu@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=oneukum@suse.com \
    --cc=stable@vger.kernel.org \
    /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).