All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] wireless: ath9k_htc: fix NULL-deref at probe
@ 2017-03-13 12:44 Johan Hovold
  2017-03-13 12:44 ` [PATCH 2/2] wireless: zd1211rw: " Johan Hovold
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Johan Hovold @ 2017-03-13 12:44 UTC (permalink / raw)
  To: Kalle Valo
  Cc: QCA ath9k Development, Daniel Drake, Ulrich Kunitz,
	linux-wireless, netdev, linux-usb, linux-kernel, Johan Hovold,
	Sujith Manoharan

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: 36bcce430657 ("ath9k_htc: Handle storage devices")
Cc: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index de2d212f39ec..9206955e865a 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -1219,6 +1219,9 @@ static int send_eject_command(struct usb_interface *interface)
 	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;
-- 
2.12.0

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

end of thread, other threads:[~2017-04-05  7:35 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-13 12:44 [PATCH 1/2] wireless: ath9k_htc: fix NULL-deref at probe Johan Hovold
2017-03-13 12:44 ` [PATCH 2/2] wireless: zd1211rw: " Johan Hovold
2017-03-22  9:04   ` [2/2] " Kalle Valo
2017-03-22  9:04     ` Kalle Valo
2017-03-22 12:45     ` Johan Hovold
2017-03-22 13:02       ` Kalle Valo
2017-03-22 13:02         ` Kalle Valo
2017-03-22 13:24         ` Johan Hovold
2017-04-03  8:42 ` [PATCH 1/2] wireless: ath9k_htc: " Johan Hovold
2017-04-03  9:34   ` Kalle Valo
2017-04-03  9:34     ` Kalle Valo
2017-04-03 13:02     ` Kalle Valo
2017-04-03 13:02       ` Kalle Valo
2017-04-03 13:16       ` Johan Hovold
2017-04-03 13:16         ` Johan Hovold
2017-04-03 13:21         ` Kalle Valo
2017-04-03 13:21           ` Kalle Valo
2017-04-03 13:26           ` Johan Hovold
2017-04-05  7:35 ` [1/2] " Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.