Skip to content

Commit a2836d3

Browse files
Chen Nimchehab
authored andcommitted
media: lmedm04: Handle errors for lme2510_int_read
Add check for the return value of usb_pipe_endpoint() and usb_submit_urb() in order to catch the errors. Fixes: 15e1ce3 ("[media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb") Signed-off-by: Chen Ni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent a7f5b36 commit a2836d3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/media/usb/dvb-usb-v2/lmedm04.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
373373
struct dvb_usb_device *d = adap_to_d(adap);
374374
struct lme2510_state *lme_int = adap_to_priv(adap);
375375
struct usb_host_endpoint *ep;
376+
int ret;
376377

377378
lme_int->lme_urb = usb_alloc_urb(0, GFP_KERNEL);
378379

@@ -390,11 +391,20 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
390391

391392
/* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */
392393
ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe);
394+
if (!ep) {
395+
usb_free_urb(lme_int->lme_urb);
396+
return -ENODEV;
397+
}
393398

394399
if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK)
395400
lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa);
396401

397-
usb_submit_urb(lme_int->lme_urb, GFP_KERNEL);
402+
ret = usb_submit_urb(lme_int->lme_urb, GFP_KERNEL);
403+
if (ret) {
404+
usb_free_urb(lme_int->lme_urb);
405+
return ret;
406+
}
407+
398408
info("INT Interrupt Service Started");
399409

400410
return 0;

0 commit comments

Comments
 (0)