]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
USB: cdc-acm: more sanity checking
authorOliver Neukum <oneukum@suse.com>
Tue, 15 Mar 2016 09:14:04 +0000 (10:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Apr 2016 16:12:40 +0000 (09:12 -0700)
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>
drivers/usb/class/cdc-acm.c

index 584514c7ed1fccb757e82ec58b7ada9083fb9cb2..b6f5c7d3737b9a034b246c281fa8a638dd7f4fae 100644 (file)
@@ -1079,6 +1079,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;
        }