]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
USB: cdc-acm: check for valid interfaces
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 16:48:15 +0000 (08:48 -0800)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 12 Jan 2015 15:43:59 +0000 (15:43 +0000)
commit 403dff4e2c94f275e24fd85f40b2732ffec268a1 upstream.

We need to check that we have both a valid data and control inteface for both
types of headers (union and not union.)

References: https://bugzilla.kernel.org/show_bug.cgi?id=83551
Reported-by: Simon Schubert <2+kernel@0x2c.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/usb/class/cdc-acm.c

index 48e7a7e6093731cdcefd63b48cb6789de98788e8..4d4f6db94c72ae84338b69d3e1313c92146268b5 100644 (file)
@@ -1192,10 +1192,11 @@ next_desc:
        } else {
                control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0);
                data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0));
-               if (!control_interface || !data_interface) {
-                       dev_dbg(&intf->dev, "no interfaces\n");
-                       return -ENODEV;
-               }
+       }
+
+       if (!control_interface || !data_interface) {
+               dev_dbg(&intf->dev, "no interfaces\n");
+               return -ENODEV;
        }
 
        if (data_interface_num != call_interface_num)