Skip to content

Commit 4e0854a

Browse files
egrumbachjmberg-intel
authored andcommitted
cfg80211: honor NL80211_RRF_NO_HT40{MINUS,PLUS}
Honor the NL80211_RRF_NO_HT40{MINUS,PLUS} flags in reg_process_ht_flags_channel. Not doing so leads can lead to a firmware assert in iwlwifi for example. Fixes: b0d7aa5 ("cfg80211: allow wiphy specific regdomain management") Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent ba83bfb commit 4e0854a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

net/wireless/reg.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
55
* Copyright 2008-2011 Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
66
* Copyright 2013-2014 Intel Mobile Communications GmbH
7+
* Copyright 2017 Intel Deutschland GmbH
78
*
89
* Permission to use, copy, modify, and/or distribute this software for any
910
* purpose with or without fee is hereby granted, provided that the above
@@ -1483,7 +1484,9 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
14831484
{
14841485
struct ieee80211_supported_band *sband = wiphy->bands[channel->band];
14851486
struct ieee80211_channel *channel_before = NULL, *channel_after = NULL;
1487+
const struct ieee80211_regdomain *regd;
14861488
unsigned int i;
1489+
u32 flags;
14871490

14881491
if (!is_ht40_allowed(channel)) {
14891492
channel->flags |= IEEE80211_CHAN_NO_HT40;
@@ -1503,17 +1506,30 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
15031506
channel_after = c;
15041507
}
15051508

1509+
flags = 0;
1510+
regd = get_wiphy_regdom(wiphy);
1511+
if (regd) {
1512+
const struct ieee80211_reg_rule *reg_rule =
1513+
freq_reg_info_regd(MHZ_TO_KHZ(channel->center_freq),
1514+
regd, MHZ_TO_KHZ(20));
1515+
1516+
if (!IS_ERR(reg_rule))
1517+
flags = reg_rule->flags;
1518+
}
1519+
15061520
/*
15071521
* Please note that this assumes target bandwidth is 20 MHz,
15081522
* if that ever changes we also need to change the below logic
15091523
* to include that as well.
15101524
*/
1511-
if (!is_ht40_allowed(channel_before))
1525+
if (!is_ht40_allowed(channel_before) ||
1526+
flags & NL80211_RRF_NO_HT40MINUS)
15121527
channel->flags |= IEEE80211_CHAN_NO_HT40MINUS;
15131528
else
15141529
channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
15151530

1516-
if (!is_ht40_allowed(channel_after))
1531+
if (!is_ht40_allowed(channel_after) ||
1532+
flags & NL80211_RRF_NO_HT40PLUS)
15171533
channel->flags |= IEEE80211_CHAN_NO_HT40PLUS;
15181534
else
15191535
channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS;

0 commit comments

Comments
 (0)