lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <53AD760311F904D0+20250714094456.259784-1-wangyuli@uniontech.com>
Date: Mon, 14 Jul 2025 17:44:56 +0800
From: WangYuli <wangyuli@...ontech.com>
To: johannes@...solutions.net
Cc: linux-wireless@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	zhanjun@...ontech.com,
	niecheng1@...ontech.com,
	guanwentao@...ontech.com,
	WangYuli <wangyuli@...ontech.com>
Subject: [PATCH] wifi: mac80211: warn on insufficient antennas for injected HT frames

When injecting frames via radiotap, an HT MCS rate can be specified.
The number of chains for that MCS implies a minimum number of
antennas that must be enabled in the antenna bitmap. Previously,
if the antenna bitmap specified fewer antennas than required by the
MCS, the bitmap was silently cleared. This makes it hard to debug
issues with injected frames.

Add a WARN_ONCE() to log a descriptive error when this happens, make
it clear that the antenna configuration was insufficient and has
been reset.

Signed-off-by: WangYuli <wangyuli@...ontech.com>
---
 net/mac80211/tx.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index d58b80813bdd..e1464ef7397d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2251,14 +2251,21 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
 		if (rate_flags & IEEE80211_TX_RC_MCS) {
 			/* reset antennas if not enough */
 			if (IEEE80211_HT_MCS_CHAINS(rate) >
-					hweight8(info->control.antennas))
+					hweight8(info->control.antennas)) {
+				WARN_ONCE(1, "Not enough antennas set for HT MCS chains (required: %d, set: %d), resetting antennas bitmap to 0\n",
+					  IEEE80211_HT_MCS_CHAINS(rate),
+					  hweight8(info->control.antennas));
 				info->control.antennas = 0;
+			}
 
 			info->control.rates[0].idx = rate;
 		} else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
 			/* reset antennas if not enough */
-			if (vht_nss > hweight8(info->control.antennas))
+			if (vht_nss > hweight8(info->control.antennas)) {
+				WARN_ONCE(1, "Not enough antennas set for VHT MCS chains (required: %d, set: %d), resetting antennas bitmap to 0\n",
+					  vht_nss, hweight8(info->control.antennas));
 				info->control.antennas = 0;
+			}
 
 			ieee80211_rate_set_vht(info->control.rates, vht_mcs,
 					       vht_nss);
-- 
2.50.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ