9e1b14a
From e6a87f147002fa16adcbafebbc458ff90a463474 Mon Sep 17 00:00:00 2001
9e1b14a
From: Oliver Neukum <oneukum@suse.com>
9e1b14a
Date: Tue, 15 Mar 2016 10:14:04 +0100
9e1b14a
Subject: [PATCH] cdc-acm: more sanity checking
9e1b14a
9e1b14a
An attack has become available which pretends to be a quirky
9e1b14a
device circumventing normal sanity checks and crashes the kernel
9e1b14a
by an insufficient number of interfaces. This patch adds a check
9e1b14a
to the code path for quirky devices.
9e1b14a
9e1b14a
Signed-off-by: Oliver Neukum <ONeukum@suse.com>
9e1b14a
CC: stable@vger.kernel.org
9e1b14a
---
9e1b14a
 drivers/usb/class/cdc-acm.c | 3 +++
9e1b14a
 1 file changed, 3 insertions(+)
9e1b14a
9e1b14a
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
9e1b14a
index 26ca4f910cb0..a7732f80a912 100644
9e1b14a
--- a/drivers/usb/class/cdc-acm.c
9e1b14a
+++ b/drivers/usb/class/cdc-acm.c
9e1b14a
@@ -1113,6 +1113,9 @@ static int acm_probe(struct usb_interface *intf,
9e1b14a
 	if (quirks == NO_UNION_NORMAL) {
9e1b14a
 		data_interface = usb_ifnum_to_if(usb_dev, 1);
9e1b14a
 		control_interface = usb_ifnum_to_if(usb_dev, 0);
9e1b14a
+		/* we would crash */
9e1b14a
+		if (!data_interface || !control_interface)
9e1b14a
+			return -ENODEV;
9e1b14a
 		goto skip_normal_probe;
9e1b14a
 	}
9e1b14a
 
9e1b14a
-- 
9e1b14a
2.5.0
9e1b14a