Commit a519be2f5d95 ("wifi: mac80211: do not use old MBSSID elements") fixed the incorrect inclusion of stopped/removed non-transmitted profiles from the Beacon frames, but it caused a regression for channel switch (CSA) and BSS color change (CCA) operations initiated from hostapd. Hostapd passes two Beacon templates to kernel for CSA and CCA - (1) beacon_csa/beacon_color_change used during the countdown. (2) beacon_after/beacon_next used after the countdown completes. Hostapd relies on the kernel to include the old MBSSID elements while sending beacon_csa/beacon_color_change templates to the driver. This path is now broken and results in CSA/CCA failure. Including existing MBSSID elements explicitly makes the netlink buffer larger than default 4 KB depending on the number of APs which would need unnecessary complication to pre-calculate the buffer length. Revert the commit to fix the regression. Regarding the original issue fixed by the reverted commit - Hostapd now has a new commit which always includes at least one MBSSID element when the feature is enabled, hence when all non-transmitted profiles are removed, this empty element ensures that stopped profiles are not advertised. Fixes: a519be2f5d95 ("wifi: mac80211: do not use old MBSSID elements") Signed-off-by: Aloka Dixit --- net/mac80211/cfg.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index bd1a857c812d..b38941e6784f 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1518,6 +1518,7 @@ ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, size = sizeof(*new) + new_head_len + new_tail_len; + /* new or old multiple BSSID elements? */ if (params->mbssid_ies) { mbssid = params->mbssid_ies; size += struct_size(new->mbssid_ies, elem, mbssid->cnt); @@ -1527,6 +1528,15 @@ ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, } size += ieee80211_get_mbssid_beacon_len(mbssid, rnr, mbssid->cnt); + } else if (old && old->mbssid_ies) { + mbssid = old->mbssid_ies; + size += struct_size(new->mbssid_ies, elem, mbssid->cnt); + if (old && old->rnr_ies) { + rnr = old->rnr_ies; + size += struct_size(new->rnr_ies, elem, rnr->cnt); + } + size += ieee80211_get_mbssid_beacon_len(mbssid, rnr, + mbssid->cnt); } new = kzalloc(size, GFP_KERNEL); -- 2.34.1 The else-if branch condition 'old && old->mbssid_ies' already guarantees 'old' is non-NULL. The inner 'old &&' in 'if (old && old->rnr_ies)' is therefore redundant; remove it. Signed-off-by: Aloka Dixit --- net/mac80211/cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index b38941e6784f..cd5781ba2873 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1531,7 +1531,7 @@ ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, } else if (old && old->mbssid_ies) { mbssid = old->mbssid_ies; size += struct_size(new->mbssid_ies, elem, mbssid->cnt); - if (old && old->rnr_ies) { + if (old->rnr_ies) { rnr = old->rnr_ies; size += struct_size(new->rnr_ies, elem, rnr->cnt); } -- 2.34.1