]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
USB: CDC ACM: Fix NULL pointer dereference
authorSven Schnelle <svens@stackframe.org>
Fri, 17 Aug 2012 19:43:43 +0000 (21:43 +0200)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Mon, 10 Feb 2014 21:11:22 +0000 (16:11 -0500)
commit 99f347caa4568cb803862730b3b1f1942639523f upstream.

If a device specifies zero endpoints in its interface descriptor,
the kernel oopses in acm_probe(). Even though that's clearly an
invalid descriptor, we should test wether we have all endpoints.
This is especially bad as this oops can be triggered by just
plugging a USB device in.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/usb/class/cdc-acm.c

index af45f735f6e5219684bc4dacd1b93086b7bcbe62..45f85df306e5e23660bfacb1d25f5c8beeb2518e 100644 (file)
@@ -1120,7 +1120,8 @@ skip_normal_probe:
        }
 
 
-       if (data_interface->cur_altsetting->desc.bNumEndpoints < 2)
+       if (data_interface->cur_altsetting->desc.bNumEndpoints < 2 ||
+           control_interface->cur_altsetting->desc.bNumEndpoints == 0)
                return -EINVAL;
 
        epctrl = &control_interface->cur_altsetting->endpoint[0].desc;