Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599326

[PATCH 1/6] [media] dib0700: fix NULL-deref at probe

From Johan Hovold <johan@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 1/6] [media] dib0700: fix NULL-deref at probe
Date 2017-03-13 14:00 +0100
Message-ID <tkxJU-Fd-31@gated-at.bofh.it> (permalink)
References <tkxJT-Fd-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <stable@vger.kernel.org>     # 3.16
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 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;
-- 
2.12.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] [media] fix missing endpoint sanity checks Johan Hovold <johan@kernel.org> - 2017-03-13 14:00 +0100
  [PATCH 3/6] [media] cx231xx-cards: fix NULL-deref at probe Johan Hovold <johan@kernel.org> - 2017-03-13 14:00 +0100
  [PATCH 4/6] [media] cx231xx-audio: fix init error path Johan Hovold <johan@kernel.org> - 2017-03-13 14:00 +0100
  [PATCH 5/6] [media] cx231xx-audio: fix NULL-deref at probe Johan Hovold <johan@kernel.org> - 2017-03-13 14:00 +0100
  [PATCH 2/6] [media] usbvision: fix NULL-deref at probe Johan Hovold <johan@kernel.org> - 2017-03-13 14:00 +0100
  [PATCH 1/6] [media] dib0700: fix NULL-deref at probe Johan Hovold <johan@kernel.org> - 2017-03-13 14:00 +0100
  [PATCH 6/6] [media] gspca: konica: add missing endpoint sanity check Johan Hovold <johan@kernel.org> - 2017-03-13 14:00 +0100

csiph-web