Skip to content

Commit

Permalink
mac80211: fix channel selection bug
Browse files Browse the repository at this point in the history
When trying to connect to an AP that advertises HT but not
VHT, the mac80211 code erroneously uses the configuration
from the AP as is instead of checking it against regulatory
and local capabilities. This can lead to using an invalid
or even inexistent channel (like 11/HT40+).

Additionally, the return flags from downgrading must be
ORed together, to collect them from all of the downgrades.
Also clarify the message.

Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
jmberg-intel committed Feb 11, 2013
1 parent d601cd8 commit 3d9646d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -3400,6 +3400,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,

ret = 0;

out:
while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef,
IEEE80211_CHAN_DISABLED)) {
if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) {
Expand All @@ -3408,14 +3409,13 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
goto out;
}

ret = chandef_downgrade(chandef);
ret |= chandef_downgrade(chandef);
}

if (chandef->width != vht_chandef.width)
sdata_info(sdata,
"local regulatory prevented using AP HT/VHT configuration, downgraded\n");
"capabilities/regulatory prevented using AP HT/VHT configuration, downgraded\n");

out:
WARN_ON_ONCE(!cfg80211_chandef_valid(chandef));
return ret;
}
Expand Down

0 comments on commit 3d9646d

Please sign in to comment.