netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: QCA ath9k Development <ath9k-devel@qca.qualcomm.com>,
	Daniel Drake <dsd@gentoo.org>,
	Ulrich Kunitz <kune@deine-taler.de>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Johan Hovold <johan@kernel.org>
Subject: [PATCH 2/2] wireless: zd1211rw: fix NULL-deref at probe
Date: Mon, 13 Mar 2017 13:44:21 +0100	[thread overview]
Message-ID: <20170313124421.28587-2-johan@kernel.org> (raw)
In-Reply-To: <20170313124421.28587-1-johan@kernel.org>

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>
---
 drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 3 +++
 1 file changed, 3 insertions(+)

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;
-- 
2.12.0

  reply	other threads:[~2017-03-13 12:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 12:44 [PATCH 1/2] wireless: ath9k_htc: fix NULL-deref at probe Johan Hovold
2017-03-13 12:44 ` Johan Hovold [this message]
     [not found]   ` <20170313124421.28587-2-johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-22  9:04     ` [2/2] zd1211rw: " Kalle Valo
2017-03-22 12:45       ` Johan Hovold
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 13:02     ` Kalle Valo
     [not found]       ` <87k271myos.fsf-HodKDYzPHsUD5k0oWYwrnHL1okKdlPRT@public.gmane.org>
2017-04-03 13:16         ` Johan Hovold
2017-04-03 13:21           ` Kalle Valo
2017-04-03 13:26             ` Johan Hovold
2017-04-05  7:35 ` [1/2] " Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170313124421.28587-2-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=ath9k-devel@qca.qualcomm.com \
    --cc=dsd@gentoo.org \
    --cc=kune@deine-taler.de \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).