Skip to content

Commit c4b9d65

Browse files
gbhat-nxpjmberg-intel
authored andcommitted
wireless: fix enabling channel 12 for custom regulatory domain
Commit e33e224 ("Revert "cfg80211: Use 5MHz bandwidth by default when checking usable channels"") fixed a broken regulatory (leaving channel 12 open for AP where not permitted). Apply a similar fix to custom regulatory domain processing. Signed-off-by: Cathy Luo <[email protected]> Signed-off-by: Ganapathi Bhat <[email protected]> Link: https://lore.kernel.org/r/[email protected] [reword commit message, fix coding style, add a comment] Signed-off-by: Johannes Berg <[email protected]>
1 parent 02a6144 commit c4b9d65

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

net/wireless/reg.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,14 +2261,15 @@ static void update_all_wiphy_regulatory(enum nl80211_reg_initiator initiator)
22612261

22622262
static void handle_channel_custom(struct wiphy *wiphy,
22632263
struct ieee80211_channel *chan,
2264-
const struct ieee80211_regdomain *regd)
2264+
const struct ieee80211_regdomain *regd,
2265+
u32 min_bw)
22652266
{
22662267
u32 bw_flags = 0;
22672268
const struct ieee80211_reg_rule *reg_rule = NULL;
22682269
const struct ieee80211_power_rule *power_rule = NULL;
22692270
u32 bw;
22702271

2271-
for (bw = MHZ_TO_KHZ(20); bw >= MHZ_TO_KHZ(5); bw = bw / 2) {
2272+
for (bw = MHZ_TO_KHZ(20); bw >= min_bw; bw = bw / 2) {
22722273
reg_rule = freq_reg_info_regd(MHZ_TO_KHZ(chan->center_freq),
22732274
regd, bw);
22742275
if (!IS_ERR(reg_rule))
@@ -2324,8 +2325,14 @@ static void handle_band_custom(struct wiphy *wiphy,
23242325
if (!sband)
23252326
return;
23262327

2328+
/*
2329+
* We currently assume that you always want at least 20 MHz,
2330+
* otherwise channel 12 might get enabled if this rule is
2331+
* compatible to US, which permits 2402 - 2472 MHz.
2332+
*/
23272333
for (i = 0; i < sband->n_channels; i++)
2328-
handle_channel_custom(wiphy, &sband->channels[i], regd);
2334+
handle_channel_custom(wiphy, &sband->channels[i], regd,
2335+
MHZ_TO_KHZ(20));
23292336
}
23302337

23312338
/* Used by drivers prior to wiphy registration */

0 commit comments

Comments
 (0)