Linux wireless drivers development
 help / color / mirror / Atom feed
From: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org
Cc: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Subject: [PATCH] scan: fix crash when driver doesn't report frame type
Date: Sat,  4 Aug 2018 23:31:11 +0300	[thread overview]
Message-ID: <20180804203111.31768-1-sergey.matyukevich.os@quantenna.com> (raw)

If driver does not know what kind of frame has been received from BSS,
then it is possible to specify CFG80211_BSS_FTYPE_UNKNOWN
in cfg80211_inform_bss[_width].

In this case neither NL80211_BSS_BEACON_IES nor NL80211_BSS_PRESP_DATA
will be reported to userspace.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
---
 scan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scan.c b/scan.c
index 09b04a5..d9681f3 100644
--- a/scan.c
+++ b/scan.c
@@ -2188,8 +2188,8 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
 		struct nlattr *bcnies = bss[NL80211_BSS_BEACON_IES];
 
 		if (bss[NL80211_BSS_PRESP_DATA] ||
-		    nla_len(ies) != nla_len(bcnies) ||
-		    memcmp(nla_data(ies), nla_data(bcnies), nla_len(ies)))
+		    (bcnies && (nla_len(ies) != nla_len(bcnies) ||
+		    memcmp(nla_data(ies), nla_data(bcnies), nla_len(ies)))))
 			printf("\tInformation elements from Probe Response "
 			       "frame:\n");
 		print_ies(nla_data(ies), nla_len(ies),
-- 
2.11.0

             reply	other threads:[~2018-08-04 22:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-04 20:31 Sergey Matyukevich [this message]
2018-08-08 11:20 ` [PATCH] iw: scan: fix crash when driver doesn't report frame type Sergey Matyukevich

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=20180804203111.31768-1-sergey.matyukevich.os@quantenna.com \
    --to=sergey.matyukevich.os@quantenna.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@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