Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Pavel Roskin <proski@gnu.org>
Cc: linux-wireless@vger.kernel.org
Subject: Re: Kernel oops in code added by "cfg80211: allow userspace to control supported rates in scan"
Date: Tue, 19 Jul 2011 23:55:17 +0200	[thread overview]
Message-ID: <1311112517.3872.0.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <4E25FA60.7040807@gnu.org> (sfid-20110719_234302_063697_7FDE84C7)

On Tue, 2011-07-19 at 17:42 -0400, Pavel Roskin wrote:

> for (i = 0; i < IEEE80211_NUM_BANDS; i++)
>        request->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;

Ah crap, I didn't pay attention and never tested a single-band card.
Below change should fix it.

johannes
---
 net/wireless/nl80211.c |    4 +++-
 net/wireless/scan.c    |    3 ++-
 net/wireless/util.c    |    3 +++
 3 files changed, 8 insertions(+), 2 deletions(-)

--- a/net/wireless/nl80211.c	2011-07-19 23:52:44.000000000 +0200
+++ b/net/wireless/nl80211.c	2011-07-19 23:53:26.000000000 +0200
@@ -3454,7 +3454,9 @@ static int nl80211_trigger_scan(struct s
 	}
 
 	for (i = 0; i < IEEE80211_NUM_BANDS; i++)
-		request->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
+		if (wiphy->bands[i])
+			request->rates[i] =
+				(1 << wiphy->bands[i]->n_bitrates) - 1;
 
 	if (info->attrs[NL80211_ATTR_SCAN_SUPP_RATES]) {
 		nla_for_each_nested(attr,
--- a/net/wireless/scan.c	2011-07-19 23:52:45.000000000 +0200
+++ b/net/wireless/scan.c	2011-07-19 23:53:21.000000000 +0200
@@ -864,7 +864,8 @@ int cfg80211_wext_siwscan(struct net_dev
 	}
 
 	for (i = 0; i < IEEE80211_NUM_BANDS; i++)
-		creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
+		if (wiphy->bands[i])
+			creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
 
 	rdev->scan_req = creq;
 	err = rdev->ops->scan(wiphy, dev, creq);
--- a/net/wireless/util.c	2011-07-19 23:53:39.000000000 +0200
+++ b/net/wireless/util.c	2011-07-19 23:53:57.000000000 +0200
@@ -1013,6 +1013,9 @@ int ieee80211_get_ratemask(struct ieee80
 {
 	int i, j;
 
+	if (!sband)
+		return -EINVAL;
+
 	if (n_rates == 0 || n_rates > NL80211_MAX_SUPP_RATES)
 		return -EINVAL;
 



  reply	other threads:[~2011-07-19 21:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-19 21:42 Kernel oops in code added by "cfg80211: allow userspace to control supported rates in scan" Pavel Roskin
2011-07-19 21:55 ` Johannes Berg [this message]
2011-07-19 22:01   ` Pavel Roskin
2011-07-19 22:26     ` Johannes Berg

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=1311112517.3872.0.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=proski@gnu.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