]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Fix beacon rate configuration for legacy rates 36, 48, 54 Mbps
authorPrasanna JS <quic_pjs@quicinc.com>
Fri, 18 Aug 2023 12:31:47 +0000 (05:31 -0700)
committerJouni Malinen <j@w1.fi>
Fri, 18 Aug 2023 18:15:41 +0000 (21:15 +0300)
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: d4f3003c56f8 ("nl80211: Configure Beacon frame TX rate if driver advertises support")
Signed-off-by: Prasanna JS <quic_pjs@quicinc.com>
src/drivers/driver_nl80211.c

index e4180daed27856e9f4e6d3ab837b8a8c06f51c7e..563ce61d7ede74e430eadcc10b427297e1242fb6 100644 (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,
-                              (u8) params->beacon_rate / 5) ||
+                              (u8) (params->beacon_rate / 5)) ||
                    nla_put(msg, NL80211_TXRATE_HT, 0, NULL) ||
                    (params->freq->vht_enabled &&
                     nla_put(msg, NL80211_TXRATE_VHT, sizeof(vht_rate),