From: John Crispin Date: Wed, 7 Aug 2019 07:59:46 +0000 (+0200) Subject: mac80211: fix TX legacy rate reporting when tx_status_ext is used X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=dc649d649a5e07eaf8f4aefb8f0e35cc178dd11f;p=openwrt%2Fstaging%2Fblogic.git mac80211: fix TX legacy rate reporting when tx_status_ext is used The RX Radiotap header length was not calculated properly when reporting legacy rates using tx_status_ext. Fixes: 3d07ffcaf320 ("mac80211: add struct ieee80211_tx_status support to ieee80211_add_tx_radiotap_header") Signed-off-by: John Crispin Link: https://lore.kernel.org/r/20190807075949.32414-1-john@phrozen.org Signed-off-by: Johannes Berg --- diff --git a/net/mac80211/status.c b/net/mac80211/status.c index f03aa8924d23..f984943cdabd 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -260,9 +260,15 @@ static int ieee80211_tx_radiotap_len(struct ieee80211_tx_info *info, int len = sizeof(struct ieee80211_radiotap_header); /* IEEE80211_RADIOTAP_RATE rate */ - if (info->status.rates[0].idx >= 0 && - !(info->status.rates[0].flags & (IEEE80211_TX_RC_MCS | - IEEE80211_TX_RC_VHT_MCS))) + if (status && status->rate && !(status->rate->flags & + (RATE_INFO_FLAGS_MCS | + RATE_INFO_FLAGS_60G | + RATE_INFO_FLAGS_VHT_MCS | + RATE_INFO_FLAGS_HE_MCS))) + len += 2; + else if (info->status.rates[0].idx >= 0 && + !(info->status.rates[0].flags & + (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))) len += 2; /* IEEE80211_RADIOTAP_TX_FLAGS */