summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-13 13:49:45 +0100
committerBen Hutchings <ben@decadent.org.uk>2017-09-15 18:29:46 +0100
commit7cc5a815aafac12f1dd550435a91fb9cad96ac7b (patch)
tree2e8f86c02f49ebd5e2f7eab96acd8df78a93a51b /drivers/watchdog
parent63ce104480a19aee4aa479088495990922c22824 (diff)
downloadlinux-stable-7cc5a815aafac12f1dd550435a91fb9cad96ac7b.tar.gz
linux-stable-7cc5a815aafac12f1dd550435a91fb9cad96ac7b.tar.bz2
linux-stable-7cc5a815aafac12f1dd550435a91fb9cad96ac7b.zip
watchdog: pcwd_usb: fix NULL-deref at probe
commit 46c319b848268dab3f0e7c4a5b6e9146d3bca8a4 upstream. 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") Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/pcwd_usb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index 1a11aedc4fe8..9eb5b314ba06 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;