nl80211: Fix beacon rate configuration for legacy rates 36, 48, 54 Mbps

Typecasting takes precedence over division here, so the legacy rates
larger than 255 * 100 kbps (i.e., 36, 48, 54 Mbps) ended up getting
truncated to invalid values.

Fix this by typecasting the value after the division.

Fixes: d4f3003c56 ("nl80211: Configure Beacon frame TX rate if driver advertises support")
Signed-off-by: Prasanna JS <quic_pjs@quicinc.com>
This commit is contained in:
Prasanna JS 2023-08-18 05:31:47 -07:00 committed by Jouni Malinen
parent dd1330b502
commit 0a6842d503

View file

@ -4531,7 +4531,7 @@ static int nl80211_put_beacon_rate(struct nl_msg *msg, u64 flags, u64 flags2,
} }
if (nla_put_u8(msg, NL80211_TXRATE_LEGACY, if (nla_put_u8(msg, NL80211_TXRATE_LEGACY,
(u8) params->beacon_rate / 5) || (u8) (params->beacon_rate / 5)) ||
nla_put(msg, NL80211_TXRATE_HT, 0, NULL) || nla_put(msg, NL80211_TXRATE_HT, 0, NULL) ||
(params->freq->vht_enabled && (params->freq->vht_enabled &&
nla_put(msg, NL80211_TXRATE_VHT, sizeof(vht_rate), nla_put(msg, NL80211_TXRATE_VHT, sizeof(vht_rate),