Skip to content

Commit

Permalink
media: dib0700: fix rc endpoint lookup
Browse files Browse the repository at this point in the history
Make sure to use the current alternate setting when verifying the
interface descriptors to avoid submitting an URB to an invalid endpoint.

Failing to do so could cause the driver to misbehave or trigger a WARN()
in usb_submit_urb() that kernels with panic_on_warn set would choke on.

Fixes: c4018fa ("[media] dib0700: fix RC support on Hauppauge Nova-TD")
Cc: stable <[email protected]>     # 3.16
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Sean Young <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
jhovold authored and mchehab committed Feb 24, 2020
1 parent bca243b commit f529810
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/usb/dvb-usb/dib0700_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf)

/* Starting in firmware 1.20, the RC info is provided on a bulk pipe */

if (intf->altsetting[0].desc.bNumEndpoints < rc_ep + 1)
if (intf->cur_altsetting->desc.bNumEndpoints < rc_ep + 1)
return -ENODEV;

purb = usb_alloc_urb(0, GFP_KERNEL);
Expand All @@ -838,7 +838,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf)
* Some devices like the Hauppauge NovaTD model 52009 use an interrupt
* endpoint, while others use a bulk one.
*/
e = &intf->altsetting[0].endpoint[rc_ep].desc;
e = &intf->cur_altsetting->endpoint[rc_ep].desc;
if (usb_endpoint_dir_in(e)) {
if (usb_endpoint_xfer_bulk(e)) {
pipe = usb_rcvbulkpipe(d->udev, rc_ep);
Expand Down

0 comments on commit f529810

Please sign in to comment.