USB: cdc-acm: more sanity checking
authorOliver Neukum <oneukum@suse.com>
Tue, 15 Mar 2016 09:14:04 +0000 (10:14 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 30 Apr 2016 22:05:19 +0000 (00:05 +0200)
commit 8835ba4a39cf53f705417b3b3a94eb067673f2c9 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/class/cdc-acm.c

index bbb2174..3d96de0 100644 (file)
@@ -926,6 +926,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;
        }