media: flexcop-usb: fix endpoint sanity check
Subsystems (2)
This is an automatic generated email to let you know that the following patch were queued:
Subject: media: flexcop-usb: fix endpoint sanity check Author: Johan Hovold <[email protected]> Date: Fri Jan 3 17:35:08 2020 +0100
commit 1b976fc6d684 ("media: b2c2-flexcop-usb: add sanity checking") added an endpoint sanity check to address a NULL-pointer dereference on probe. Unfortunately the check was done on the current altsetting which was later changed.
Fix this by moving the sanity check to after the altsetting is changed.
Fixes 1b976fc6d684 ("media: b2c2-flexcop-usb: add sanity checking")
Cc Oliver Neukum <[email protected]>
Cc stable <[email protected]>
Signed-off-by Johan Hovold <[email protected]>
Signed-off-by Sean Young <[email protected]>
Signed-off-by Mauro Carvalho Chehab <[email protected]>
drivers/media/usb/b2c2/flexcop-usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
---
drivers/media/usb/b2c2/flexcop-usb.c +3 -3
@@ -511,6 +511,9 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb)return ret; } +if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints <1 ) +return -ENODEV ; +switch (fc_usb->udev->speed) {case USB_SPEED_LOW :err ("cannot handle USB speed because it is too slow." );
@@ -544,9 +547,6 @@ 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 ;