From: Oliver Neukum Date: Tue, 30 Jul 2019 07:48:27 +0000 (+0200) Subject: media: b2c2-flexcop-usb: add sanity checking X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1b976fc6d684e3282914cdbe7a8d68fdce19095c;p=openwrt%2Fstaging%2Fblogic.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 4bf85e9b78b8..d1331f828108 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;