]> asedeno.scripts.mit.edu Git - linux.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)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 9 Nov 2019 08:14:35 +0000 (09:14 +0100)
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>
drivers/media/usb/b2c2/flexcop-usb.c

index 4bf85e9b78b815d687e5ecf3f247ad2c85df255f..d1331f8281082d719b307dc52c8aa55f65ad75de 100644 (file)
@@ -544,6 +544,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;