]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: b2c2-flexcop-usb: add sanity checking
authorOliver Neukum <oneukum@suse.com>
Tue, 30 Jul 2019 07:48:27 +0000 (09:48 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 10 Dec 2019 18:01:28 +0000 (18:01 +0000)
commit 1b976fc6d684e3282914cdbe7a8d68fdce19095c upstream.

The driver needs an isochronous endpoint to be present. It will
oops in its absence. Add checking for it.

Reported-by: syzbot+d93dff37e6a89431c158@syzkaller.appspotmail.com
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/media/usb/b2c2/flexcop-usb.c

index 0bd96906339227ec8b3df4e78640fc500be4fb87..83d3a5cf272f2587041e35d7f79b01407b414cd2 100644 (file)
@@ -508,6 +508,9 @@ static int flexcop_usb_probe(struct usb_interface *intf,
        struct flexcop_device *fc = NULL;
        int ret;
 
+       if (intf->cur_altsetting->desc.bNumEndpoints < 1)
+               return -ENODEV;
+
        if ((fc = flexcop_device_kmalloc(sizeof(struct flexcop_usb))) == NULL) {
                err("out of memory\n");
                return -ENOMEM;