]> git.hungrycats.org Git - linux/commitdiff
USB: cdc-acm: more sanity checking
authorOliver Neukum <oneukum@suse.com>
Tue, 15 Mar 2016 09:14:04 +0000 (10:14 +0100)
committerJiri Slaby <jslaby@suse.cz>
Mon, 11 Apr 2016 14:44:04 +0000 (16:44 +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: Jiri Slaby <jslaby@suse.cz>
drivers/usb/class/cdc-acm.c

index c0ed832d8ad5072ef784cfbc105ea75aac625fca..ba6b978d9de45c889df6dc4e8c777820a1aa954a 100644 (file)
@@ -989,6 +989,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;
        }