linux/net/mac80211
François Roux f394cbd098 wifi: mac80211: don't estimate airtime for unsupported rate widths
ieee80211_fill_rate_info() copies the driver's rate_info bandwidth into
the rx_status as is, but ieee80211_get_rate_duration() only handles
20/40/80/160/320 MHz. When a driver reports another width, e.g. an
HE/EHT RU allocation, it hits WARN_ON_ONCE() and returns 0 without
setting *overhead. ieee80211_rate_expected_tx_airtime() then goes on
using the uninitialized overhead, as Dan's static checker report
points out.

Seen on a Microsoft Surface Pro 11 (WCN7850, ath12k) while
NetworkManager dumps station info:

  WARNING: net/mac80211/airtime.c:532 at ieee80211_get_rate_duration.isra.0+0xc0/0x180 [mac80211]
   ieee80211_get_rate_duration.isra.0+0xc0/0x180 [mac80211]
   sta_estimate_expected_throughput.isra.0+0x38/0x64 [mac80211]
   sta_set_sinfo+0x7fc/0x8e4 [mac80211]
   ieee80211_dump_station+0x4c/0x84 [mac80211]
   nl80211_dump_station+0x594/0x7e8 [cfg80211]

Only accept widths that ieee80211_get_rate_duration() handles in
ieee80211_fill_rate_info(). Other widths then give no estimate instead
of a warning. Also return 0 from ieee80211_rate_expected_tx_airtime()
when no duration could be computed, as ieee80211_calc_rx_airtime()
already does.

Tested on the Surface Pro 11 with next-20260929: Wi-Fi works and
"expected throughput" is still reported (about 1049 Mbit/s for a
1297 Mbit/s HE 160 MHz tx rate). The warning itself is rare (twice in
several days of use), so this does not prove it is gone, only that the
change does not break the normal path.

Fixes: 094dc1619c ("wifi: mac80211: factor out part of ieee80211_calc_expected_tx_airtime")
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/all/aneGlCMVnqRhlf6p@stanley.mountain/
Assisted-by: LLM
Signed-off-by: François Roux <franzelfranzel@gmail.com>
Link: https://patch.msgid.link/20261006083751.4015-1-franzelfranzel@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-07 12:46:15 +02:00
..
tests wifi: mac80211: parse and apply UHR DBE channel 2026-06-03 14:11:58 +02:00
aead_api.c
aead_api.h
aes_ccm.h
aes_cmac.c wifi: mac80211: Use AES-CMAC library in ieee80211_aes_cmac() 2026-03-09 13:27:21 -07:00
aes_cmac.h wifi: mac80211: Use AES-CMAC library in ieee80211_aes_cmac() 2026-03-09 13:27:21 -07:00
aes_gcm.h
aes_gmac.c wifi: mac80211: utilize the newly defined CMAC constants 2025-11-20 11:56:19 +01:00
aes_gmac.h wifi: mac80211: utilize the newly defined CMAC constants 2025-11-20 11:56:19 +01:00
agg-rx.c wifi: mac80211: shut down RX BA session timer on teardown 2026-09-22 10:47:51 +02:00
agg-tx.c wifi: mac80211: fix tid_tx use-after-free on BA session stop 2026-07-28 15:03:42 +02:00
airtime.c wifi: mac80211: don't estimate airtime for unsupported rate widths 2026-10-07 12:46:15 +02:00
ap.c wifi: mac80211: AP: handle DBE for clients 2026-06-03 14:11:58 +02:00
cfg.c wifi: mac80211: refuse to make a monitor active when it has no queue 2026-09-14 14:52:49 +02:00
chan.c wifi: mac80211: keep paired old chanctx alive 2026-09-21 14:37:36 +02:00
debug.h wifi: mac80211: don't WARN for late channel/color switch 2025-06-17 14:30:06 +02:00
debugfs_key.c wifi: mac80211: Clean up debugfs_key deadcode 2025-01-13 13:51:19 +01:00
debugfs_key.h wifi: mac80211: Clean up debugfs_key deadcode 2025-01-13 13:51:19 +01:00
debugfs_netdev.c wifi: mac80211: don't access the TSF of a down interface 2026-09-09 14:51:31 +02:00
debugfs_netdev.h wifi: mac80211: fix driver debugfs for vif type change 2024-02-02 13:09:55 +01:00
debugfs_sta.c wifi: mac80211: Remove redundant rcu_read_lock/unlock() in spin_lock 2025-09-19 11:48:14 +02:00
debugfs_sta.h
debugfs.c wifi: mac80211: suppress chanctx warning for debugfs reset 2026-09-09 14:51:28 +02:00
debugfs.h
driver-ops.c wifi: mac80211: make monitor link info check more specific 2025-11-11 11:05:19 +01:00
driver-ops.h wifi: mac80211: add NAN peer schedule support 2026-04-07 15:36:03 +02:00
drop.h wifi: mac80211: drop oversized fragments to avoid extra_len overflow 2026-09-21 16:30:08 +02:00
eht.c wifi: mac80211: move frame RX handling to type files 2026-05-05 14:49:01 +02:00
ethtool.c wifi: mac80211: add tx_handlers_drop statistics to ethtool 2025-09-10 15:04:27 +02:00
fils_aead.c wifi: mac80211: handle empty FILS association request payload 2026-09-21 16:30:25 +02:00
fils_aead.h
he.c wifi: mac80211: refactor link STA bandwidth update 2026-06-03 14:11:58 +02:00
ht.c wifi: mac80211: refactor link STA bandwidth update 2026-06-03 14:11:58 +02:00
ibss.c Mostly driver changes this time: 2026-07-27 16:03:40 -07:00
ieee80211_i.h wifi: mac80211: prevent AP VLAN tx from other interfaces 2026-09-22 10:47:55 +02:00
iface.c netfilter pull request 26-09-30 2026-10-01 12:00:40 +02:00
Kconfig wifi: mac80211: Use AES-CMAC library in aes_s2v() 2026-03-09 13:27:21 -07:00
key.c wifi: mac80211: allow cipher change on NAN_DATA interfaces 2026-05-20 12:03:38 +02:00
key.h wifi: mac80211: Use AES-CMAC library in ieee80211_aes_cmac() 2026-03-09 13:27:21 -07:00
led.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
led.h
link.c wifi: mac80211: skip default WMM setup for AP_VLAN links 2026-08-06 14:03:36 +02:00
main.c wifi: mac80211: add HE 6 GHz capability in the scan elems len 2026-09-09 14:51:31 +02:00
Makefile wifi: mac80211: move frame RX handling to type files 2026-05-05 14:49:01 +02:00
mesh_hwmp.c wifi: mac80211: Fix -Wc23-extensions in hwmp_route_info_get() 2026-06-05 09:55:08 +02:00
mesh_pathtbl.c wifi: mac80211: fix mesh fast xmit path deletion UAF 2026-09-21 16:30:25 +02:00
mesh_plink.c wifi: mac80211: remove 5/10 MHz channel code 2026-06-03 14:07:06 +02:00
mesh_ps.c wifi: mac80211: support parsing S1G TIM PVB 2025-09-04 11:19:01 +02:00
mesh_sync.c wifi: mac80211: export ieee80211_calculate_rx_timestamp 2026-04-07 15:36:02 +02:00
mesh.c wifi: mac80211: mesh: reset the CSA state when leaving 2026-09-09 14:51:31 +02:00
mesh.h wifi: mac80211: split mesh fast tx cache into local/proxied/forwarded 2024-04-17 09:21:32 +02:00
mlme.c wifi: mac80211: keep fallback association elements alive 2026-09-22 10:47:53 +02:00
nan.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
ocb.c wifi: mac80211: clean up initial STA NSS/bandwidth handling 2026-04-28 09:27:46 +02:00
offchannel.c wifi: mac80211: don't start a ROC while scanning 2026-09-09 14:51:27 +02:00
parse.c wifi: use UHR operation field presence bits 2026-07-21 19:18:52 +02:00
pm.c wifi: mac80211: suppress chanctx warning for debugfs reset 2026-09-09 14:51:28 +02:00
rate.c wifi: mac80211: don't apply peer rates to off-channel frames 2026-09-09 14:51:27 +02:00
rate.h wifi: mac80211: convert debugfs files to short fops 2024-10-23 16:47:07 +02:00
rc80211_minstrel_ht_debugfs.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
rc80211_minstrel_ht.c wifi: mac80211: validate TX status rate metadata 2026-09-22 10:47:47 +02:00
rc80211_minstrel_ht.h
rx.c wifi: mac80211: drop oversized fragments to avoid extra_len overflow 2026-09-21 16:30:08 +02:00
s1g.c Quite a bunch more work, of note: 2026-08-06 12:39:11 -07:00
scan.c wifi: mac80211: don't warn when an IBSS has no channel to scan 2026-09-09 14:51:28 +02:00
spectmgmt.c wifi: mac80211: reject invalid 320 MHz CSA bandwidth 2026-09-28 11:10:01 +02:00
sta_info.c wifi: mac80211: drain PS delivery work during station teardown 2026-09-21 16:00:51 +02:00
sta_info.h wifi: mac80211: add AQL support for multicast packets 2026-07-28 16:02:03 +02:00
status.c wifi: mac80211: validate TX status rate metadata 2026-09-22 10:47:47 +02:00
tdls.c wifi: mac80211: require a peer station for TDLS setup confirm 2026-09-09 14:51:30 +02:00
tkip.c Merge net-next/main to resolve conflicts 2024-10-09 08:59:22 +02:00
tkip.h
trace_msg.h wifi: mac80211: remove unused MAX_MSG_LEN define 2024-02-08 12:50:09 +01:00
trace.c
trace.h wifi: mac80211: add NPCA to chandef tracing 2026-05-05 14:49:03 +02:00
tx.c wifi: mac80211: fix slab-out-of-bounds read in ieee80211_monitor_select_queue() 2026-09-28 11:11:19 +02:00
uhr.c wifi: mac80211: update UHR capabilities field order 2026-05-05 14:49:01 +02:00
util.c Mostly driver changes this time: 2026-07-27 16:03:40 -07:00
vht.c wifi: mac80211: clarify per-STA bandwidth handling 2026-04-28 09:29:02 +02:00
wbrf.c wifi: mac80211: use cfg80211_chandef_get_width() 2025-03-12 09:50:27 +01:00
wep.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
wep.h
wme.c
wme.h
wpa.c Networking changes for 7.1. 2026-04-14 18:36:10 -07:00
wpa.h wifi: mac80211: refactor CMAC packet handlers 2025-11-20 11:56:19 +01:00