linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watchdog: pcwd_usb: fix NULL-deref at probe
@ 2017-03-13 12:49 Johan Hovold
  2017-03-13 13:42 ` Guenter Roeck
  2017-03-13 17:16 ` Guenter Roeck
  0 siblings, 2 replies; 11+ messages in thread
From: Johan Hovold @ 2017-03-13 12:49 UTC (permalink / raw)
  To: Wim Van Sebroeck
  Cc: Guenter Roeck, linux-watchdog, linux-kernel, Johan Hovold, stable

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/watchdog/pcwd_usb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index 99ebf6ea3de6..5615f4013924 100644
--- a/drivers/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
@@ -630,6 +630,9 @@ static int usb_pcwd_probe(struct usb_interface *interface,
 		return -ENODEV;
 	}
 
+	if (iface_desc->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	/* check out the endpoint: it has to be Interrupt & IN */
 	endpoint = &iface_desc->endpoint[0].desc;
 
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-05-14 13:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-13 12:49 [PATCH] watchdog: pcwd_usb: fix NULL-deref at probe Johan Hovold
2017-03-13 13:42 ` Guenter Roeck
2017-03-13 14:17   ` Johan Hovold
2017-03-13 17:15     ` Guenter Roeck
2017-03-13 17:16 ` Guenter Roeck
2017-04-03  8:36   ` Johan Hovold
2017-04-03 14:05     ` Guenter Roeck
2017-05-12 10:36       ` Johan Hovold
2017-05-12 16:59         ` Guenter Roeck
2017-05-14 13:05           ` Wim Van Sebroeck
2017-05-14 13:20             ` Wim Van Sebroeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).