From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387908; b=Uxv+SLCraggVkxvMNmJohVmVXmAZU21mjyc9EdBPn5LahoKdSh3boTT5tVP2F4U6c83l /8oDn4jqdFH3TKjd2O/Rsl6A+wu3WJ5r/9h2pVz27sa8m1t44PcUud7urPdpIqgLs2Es9 aoRPf8/HY861PhPqteY5DhpxRvBxofitBeJPbc0nvSPNpd7g4Ack1yM/b3N9dPuz4uTzM bOxyByDoWwEiwMcP7tkosVUwa2QTBXAN1Tc4XLPcltXM49Bz52/mSipY0hWrg4utiZSwS ICm0yg+IO5SZgWHh6qqIadh36h6dZsoc7hX2kiG2V0KUlJK4ngaIDkD7xeGnRzDULRw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387908; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=n55lVQ3m/N7pYbxik74rpMBQRxjbVcI4vvRxHcki8Sw=; b=ZrWzEk1aQYbu4b8RbjJPSU+vxn9D182Ck60FQGMYRC7wK91LVxFjtpICMWJwM4XS9un5 DDeJP8jFCCiMZdXX3v0Fpgtc12yvq9UHmcR0x4/3fgeivvgiG1k0w9cE7MI/BXb2BGJXG fvLY96FhMIZeuypgNCMyl0yAJ+zvRM5Q9fWG82i+neTivFyfAWLtoQniku3B4FCRPqFuv v9PWGZrzxuc0YfXwZbZ8TYI5W2oyo7meI/VtZg5dKInYY1ErDsjqGVGI23EGpngdthPGK 4sE61QoJCXfHOiGOmeWmcytYWwMgO/dkIYDkewgmaI9WgHqjxmfD/rkLswz7LzYnevQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=RsbQ1y4C; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18D55606A322; Fri, 4 Dec 2026 12:38:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=RsbQ1y4C Received: by smtp.kernel.org (Postfix) with ESMTPSA id 816411F00897; Fri, 4 Dec 2026 12:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387908; bh=n55lVQ3m/N7pYbxik74rpMBQRxjbVcI4vvRxHcki8Sw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RsbQ1y4CdFabez1QMSCzRq/CzyqJ/OwaVoXwbnarqj7tuE+S8MV6xsmyriAmueXta dOqltRwBLnhoIBYa99G50HpOM3EHhUM1qcNeu//HEC4wQG99RtmWKRrALy64vz7EBk nBja4WWCc09wM8Ch7O0miZABUkhWYak/ZLLvI8l8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johannes Berg , Sasha Levin Subject: [PATCH 6.1 0366/1059] wifi: mac80211: limit injected HT/VHT MCSes Date: Fri, 4 Dec 2026 18:58:17 +0900 Message-ID: <20261204100653.755344551@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johannes Berg [ Upstream commit 22d8e38161c722fe6e7ffb2a4c7fadab0f111271 ] With radiotap injection the HT/VHT MCSes can be just about anything, but that can later get problematic. Limit them to the rates the device reports, which is presumably going to be a subset of what mac80211 can do, except for HT MCS 32 which some devices report as supported, but then TX status can't deal with it. If it's not supported just ignore the config. Assisted-by: LLM Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames") Fixes: 646e76bb5daf ("mac80211: parse VHT info in injected frames") Link: https://patch.msgid.link/20261005224950.68e210b8487a.I2ee0e4664c54cf31002eb9e4f5190fd05ff4130f@changeid Signed-off-by: Johannes Berg [ sashal: Dropped the chandef argument and the antenna-reset context lines, and placed the new VHT helper after ieee80211_validate_radiotap_len() because the older tree lacks ieee80211_rate_bw_usable(). ] Signed-off-by: Sasha Levin --- net/mac80211/tx.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 3fa10e1d56431..6dba93bca9b8e 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2131,6 +2131,27 @@ static bool ieee80211_validate_radiotap_len(struct sk_buff *skb) return true; } +static bool +ieee80211_vht_tx_rate_supported(const struct ieee80211_sta_vht_cap *vht_cap, + u8 mcs, u8 nss) +{ + u16 map = le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map); + + if (!vht_cap->vht_supported) + return false; + + switch ((map >> (2 * (nss - 1))) & 3) { + case IEEE80211_VHT_MCS_SUPPORT_0_7: + return mcs <= 7; + case IEEE80211_VHT_MCS_SUPPORT_0_8: + return mcs <= 8; + case IEEE80211_VHT_MCS_SUPPORT_0_9: + return mcs <= 9; + default: + return false; + } +} + bool ieee80211_parse_tx_radiotap(struct sk_buff *skb, struct net_device *dev) { @@ -2309,10 +2330,16 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb, } if (rate_flags & IEEE80211_TX_RC_MCS) { - info->control.rates[0].idx = rate; + /* MCS 32 and up aren't handled, e.g. by TX status */ + if (sband && sband->ht_cap.ht_supported && rate < 32 && + sband->ht_cap.mcs.rx_mask[rate / 8] & BIT(rate % 8)) + info->control.rates[0].idx = rate; } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) { - ieee80211_rate_set_vht(info->control.rates, vht_mcs, - vht_nss); + if (sband && + ieee80211_vht_tx_rate_supported(&sband->vht_cap, + vht_mcs, vht_nss)) + ieee80211_rate_set_vht(info->control.rates, + vht_mcs, vht_nss); } else if (sband) { for (i = 0; i < sband->n_bitrates; i++) { if (rate * 5 != sband->bitrates[i].bitrate) -- 2.53.0