nl80211: fix beacon tx rate mask validation

While adding HE MCS beacon tx rate support, it is observed that legacy
beacon tx rate in VHT hwsim test suite is failed. Whenever the
application doesn't explicitly set VHT/MCS rate attribute in fixed rate
command, by default all HE MCS masks are enabled in cfg80211. In beacon
fixed rate, more than one rate mask is not allowed. Fix that by not
setting all rate mask by default in case of beacon tx rate.

Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
Link: https://lore.kernel.org/r/1602879327-29488-1-git-send-email-rmanohar@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git
Git-commit: 857b34c4fb104cecc95cd5c5fea5052628758a0f
[quic_deng@quicinc.com: Make appropriate modifications to adapt kernel-5.4.]
Change-Id: I85c5bd502b88ca2157fdc74e4c39de6e75580652
Signed-off-by: Xin Deng <quic_deng@quicinc.com>
This commit is contained in:
Xin Deng 2023-10-09 16:07:25 +08:00
commit bf0f28818c

View file

@ -4408,7 +4408,8 @@ static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = {
};
static int nl80211_parse_tx_bitrate_mask(struct genl_info *info,
struct cfg80211_bitrate_mask *mask)
struct cfg80211_bitrate_mask *mask,
bool default_all_enabled)
{
struct nlattr *tb[NL80211_TXRATE_MAX + 1];
struct cfg80211_registered_device *rdev = info->user_ptr[0];
@ -4420,6 +4421,9 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info,
memset(mask, 0, sizeof(*mask));
/* Default to all rates enabled */
for (i = 0; i < NUM_NL80211_BANDS; i++) {
if (!default_all_enabled)
break;
sband = rdev->wiphy.bands[i];
if (!sband)
@ -4943,7 +4947,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;
if (info->attrs[NL80211_ATTR_TX_RATES]) {
err = nl80211_parse_tx_bitrate_mask(info, &params.beacon_rate);
err = nl80211_parse_tx_bitrate_mask(info, &params.beacon_rate, false);
if (err)
return err;
@ -10725,7 +10729,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
if (!rdev->ops->set_bitrate_mask)
return -EOPNOTSUPP;
err = nl80211_parse_tx_bitrate_mask(info, &mask);
err = nl80211_parse_tx_bitrate_mask(info, &mask, true);
if (err)
return err;
@ -11321,7 +11325,7 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
}
if (info->attrs[NL80211_ATTR_TX_RATES]) {
err = nl80211_parse_tx_bitrate_mask(info, &setup.beacon_rate);
err = nl80211_parse_tx_bitrate_mask(info, &setup.beacon_rate, false);
if (err)
return err;