summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/zydas
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-13 13:44:21 +0100
committerKalle Valo <kvalo@codeaurora.org>2017-03-22 11:03:37 +0200
commitca260ece6a57dc7d751e0685f51fa2c55d851873 (patch)
tree380dbd246d27897a2e4aa561e23f4d850187d304 /drivers/net/wireless/zydas
parent5ce33b603063f36272fcfb1b4a5fde69f46eca88 (diff)
downloadblackbird-op-linux-ca260ece6a57dc7d751e0685f51fa2c55d851873.tar.gz
blackbird-op-linux-ca260ece6a57dc7d751e0685f51fa2c55d851873.zip
zd1211rw: fix NULL-deref at probe
Make sure to check the number of endpoints to avoid dereferencing a NULL-pointer or accessing memory beyond the endpoint array should a malicious device lack the expected endpoints. Fixes: a1030e92c150 ("[PATCH] zd1211rw: Convert installer CDROM device into WLAN device") Cc: Daniel Drake <dsd@gentoo.org> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/zydas')
-rw-r--r--drivers/net/wireless/zydas/zd1211rw/zd_usb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
index c5effd6c6be9..01ca1d57b3d9 100644
--- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
@@ -1278,6 +1278,9 @@ static int eject_installer(struct usb_interface *intf)
u8 bulk_out_ep;
int r;
+ if (iface_desc->desc.bNumEndpoints < 2)
+ return -ENODEV;
+
/* Find bulk out endpoint */
for (r = 1; r >= 0; r--) {
endpoint = &iface_desc->endpoint[r].desc;
OpenPOWER on IntegriCloud