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=1796385027; b=UBQwRcAmEeKF3iMU7PLYwZ8zHXZRe/xxhLXYTE+N7UktThD/zutNbYc8aRUbQifiHxXj KdAGtPqNgLTdeYsym013pabydfnKveoLaIsQxNuBeMHDGtUyvv7BGNhIZ4CfsLCW6wEe7 kgWHDS1ZtB/zhb3qgqQvnoZqF/QQzHwQ7WTc9ziKc0M4f2f6Ay484FzIHubBNX1JqLmbG p9Gvt3ANX81bwommO0d3UjQMwIbwILZNvcVeJtSmYGrxIBRdL29tCtbYxiP0x0PZVfJG+ lXdWwRZva1zlBtsFcmZ8g0rzTthxDEdMUtAUuwQRdOe7StehYYjErZaYynXKRRDCgPQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385027; 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=KKaIaaLN+i9JSGnrjHtI6x4iF2bNAOJyhCTonPwTV/k=; b=5rQuKNkAi5lVGi+U/GHhjmWJHoLoUX+H/gwA0SO1VOCU3rxlP3vkgl5SLiuhe9c0xxDx T7GebUGVPJHFC/oaUzaS8GhulHPrDs/yU4dlYG1SayiDxYUzMKhSYi8zXyGGLHs9GlA3V A+xf1Jn3Gqq7NBr1+fMaa4MvlJkTPEzP0gpe5FGbUXPvA5f3kSlEBw0q/13dHC2xSumen qvhAx+VMMBFGJNUgbA2eh3D3unnCKiSR1pb5kZyzijMVtY+m+0rVq6PyTY7udGXjgcxmi Y1RDmx+BAh6CB5GdxWtbsk08bToXVHHAa2a0AjhhTVyhbI0gwm51muyXcTwmaVFKRHA== 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=ruw1cFKm; 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 7A07C606A322; Fri, 4 Dec 2026 11:50:27 +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=ruw1cFKm Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB35F1F00A02; Fri, 4 Dec 2026 11:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385027; bh=KKaIaaLN+i9JSGnrjHtI6x4iF2bNAOJyhCTonPwTV/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ruw1cFKm7gUoXtCMeBoLN2iiqyVGE0LAOPgrILaH6yyHxKP5PNaDDL6uux2xOt7Z/ e3WCqQ6GDrXNHGzK7Y+vTNsnfbJOw4hNnxBztpNSH0xpdBzwHtugeVYBpRyiO8lEjl +i/Fr1knHmYy3useumHKd2xOKgWSOwNMivRAFQP0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johannes Berg , Sasha Levin Subject: [PATCH 6.6 0389/1167] wifi: mac80211: limit injected HT/VHT MCSes Date: Fri, 4 Dec 2026 18:56:56 +0900 Message-ID: <20261204100712.157686526@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-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 antenna-reset and chandef/bandwidth context the tree lacks, and placed the new VHT helper before ieee80211_parse_tx_radiotap() instead of after 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 9e9b5ad93be18..96ee7798a6b49 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2144,6 +2144,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) { @@ -2322,10 +2343,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