Linux wireless drivers development
 help / color / mirror / Atom feed
From: Maya Erez <qca_merez@qualcomm.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: Maya Erez <qca_merez@qualcomm.com>,
	linux-wireless@vger.kernel.org, wil6210@qualcomm.com
Subject: [PATCH 1/2] wil6210: fix chan check in wil_p2p_listen
Date: Wed,  8 Jun 2016 20:07:47 +0300	[thread overview]
Message-ID: <1465405668-15881-2-git-send-email-qca_merez@qca.qualcomm.com> (raw)
In-Reply-To: <1465405668-15881-1-git-send-email-qca_merez@qca.qualcomm.com>

In wil_p2p_listen chan is checked to protect against NULL
pointer access only before setting channel = chan->hw_value.
Add a global parameter check to cover all accesses to chan.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 drivers/net/wireless/ath/wil6210/p2p.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/p2p.c b/drivers/net/wireless/ath/wil6210/p2p.c
index 1c91538..213b825 100644
--- a/drivers/net/wireless/ath/wil6210/p2p.c
+++ b/drivers/net/wireless/ath/wil6210/p2p.c
@@ -114,8 +114,10 @@ int wil_p2p_listen(struct wil6210_priv *wil, unsigned int duration,
 	u8 channel = P2P_DMG_SOCIAL_CHANNEL;
 	int rc;
 
-	if (chan)
-		channel = chan->hw_value;
+	if (!chan)
+		return -EINVAL;
+
+	channel = chan->hw_value;
 
 	wil_dbg_misc(wil, "%s: duration %d\n", __func__, duration);
 
-- 
1.8.5.2


  reply	other threads:[~2016-06-08 17:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 17:07 [PATCH 0/2] wil6210 patches Maya Erez
2016-06-08 17:07 ` Maya Erez [this message]
2016-06-14 13:20   ` [1/2] wil6210: fix chan check in wil_p2p_listen Kalle Valo
2016-06-08 17:07 ` [PATCH 2/2] wil6210: abort P2P search when stopping P2P device Maya Erez

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=1465405668-15881-2-git-send-email-qca_merez@qca.qualcomm.com \
    --to=qca_merez@qualcomm.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=wil6210@qualcomm.com \
    /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