From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from www.linuxtv.org ([130.149.80.248]:42489 "EHLO www.linuxtv.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752750AbdDJKkr (ORCPT ); Mon, 10 Apr 2017 06:40:47 -0400 From: Mauro Carvalho Chehab Date: Mon, 10 Apr 2017 10:29:20 +0000 Subject: [git:media_tree/master] [media] dib0700: fix NULL-deref at probe To: linuxtv-commits@linuxtv.org Cc: Hans Verkuil , Mauro Carvalho Chehab , stable , Johan Hovold Reply-to: linux-media@vger.kernel.org Message-Id: Sender: stable-owner@vger.kernel.org List-ID: This is an automatic generated email to let you know that the following patch were queued: Subject: [media] dib0700: fix NULL-deref at probe Author: Johan Hovold Date: Mon Mar 13 09:53:54 2017 -0300 Make sure to check the number of endpoints to avoid dereferencing a NULL-pointer should a malicious device lack endpoints. Fixes: c4018fa2e4c0 ("[media] dib0700: fix RC support on Hauppauge Nova-TD") Cc: stable # 3.16 Cc: Mauro Carvalho Chehab Signed-off-by: Johan Hovold Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/dvb-usb/dib0700_core.c | 3 +++ 1 file changed, 3 insertions(+) --- diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c index dd5edd3a17ee..08acdd32e412 100644 --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c @@ -809,6 +809,9 @@ 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) + return -ENODEV; + purb = usb_alloc_urb(0, GFP_KERNEL); if (purb == NULL) return -ENOMEM;