From: Oliver Neukum Date: Tue, 30 Jul 2019 07:48:27 +0000 (+0200) Subject: media: b2c2-flexcop-usb: add sanity checking X-Git-Tag: v5.10.7~3807^2^2~33 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b976fc6d684e3282914cdbe7a8d68fdce19095c;p=platform%2Fkernel%2Flinux-rpi.git media: b2c2-flexcop-usb: add sanity checking 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 Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c index 4bf85e9..d1331f8 100644 --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -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;