summaryrefslogtreecommitdiff
path: root/net/mac80211
AgeCommit message (Collapse)Author
11 dayswifi: mac80211: fix unlocked STA statistics fallbackDavid Carlier
The unlocked station statistics path returns -EAGAIN whenever the driver has no atomic statistics op, even if it has no statistics op at all. For drivers without any statistics op, which is most of them, every get/dump therefore falls back to the wiphy mutex and the unlocked path never helps. Only return -EAGAIN when the driver has a locked op but no atomic one. The link variant also checked the wrong op before calling the atomic link callback, ignored its return value, and lost its entry tracepoint. Fix those too. Fixes: ab5d6dd9c9b0 ("wifi: mac80211: implement unlocked STA statistics") Signed-off-by: David Carlier <devnexen@gmail.com> Link: https://patch.msgid.link/20261031200133.473693-1-devnexen@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: fix use-after-free on TTLM disconnectJohannes Berg
If ieee80211_process_adv_ttlm() disconnects, and some other changes were also detected in the beacon, the link update to the driver is still done, leading to use-after-free. Fix this by returning, like other functions, whether or not the update was accepted by the function. Cc: stable@vger.kernel.org Fixes: 702e80470a33 ("wifi: mac80211: support handling of advertised TID-to-link mapping") Reviewed-by: Benjamin Berg <benjamin.berg@intel.com> Link: https://patch.msgid.link/20261102220313.3cf5e709417b.I339967c7e614057253aa68c005d9ae220577f99a@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: bound pending OCB station allocationsZhao Li
Delaying the OCB station worker while frames arrive from new peers can retain an unbounded number of station allocations. The receive-side limit counts installed stations, while new allocations wait on incomplete_stations until process context inserts them. The list lock does not cover the interval between allocation and list insertion. Reserve one of 128 pending slots per interface before allocation. Release the reservation on allocation failure, after the worker inserts or frees the station, and when leave frees the pending list. LLM assistance was used to find the bug and review. Fixes: 239281f803e2 ("mac80211: 802.11p OCB mode support") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li <enderaoelyther@gmail.com> Link: https://patch.msgid.link/20261028142302.16634-3-enderaoelyther@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: recheck the OCB station limit before insertionZhao Li
Frames from successive unknown OCB peers can make the deferred worker install more than 128 stations. The receive path checks local->num_sta before allocating each station, but pending stations are not included in that count. Several allocations can therefore pass before the worker inserts any of them, and the worker then drains the list without rechecking the limit. Recheck the installed-station limit in the worker under the wiphy mutex and free entries that no longer fit. LLM assistance was used to find the bug and review. Fixes: 239281f803e2 ("mac80211: 802.11p OCB mode support") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li <enderaoelyther@gmail.com> Link: https://patch.msgid.link/20261028142302.16634-2-enderaoelyther@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: bound pending IBSS station allocationsZhao Li
Delaying the IBSS station worker while frames arrive from new peers can retain an unbounded number of station allocations. The receive-side limit counts installed stations, while new allocations wait on incomplete_stations until process context inserts them. The list lock does not cover the interval between allocation and list insertion. Reserve one of 128 pending slots per interface before allocation. Release the reservation on allocation failure, after the worker inserts or frees the station, and when disconnect frees the pending list. LLM assistance was used to find the bug and review. Fixes: 8bf11d8d0811 ("mac80211: delay IBSS station insertion") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li <enderaoelyther@gmail.com> Link: https://patch.msgid.link/20261028142235.15428-3-enderaoelyther@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: recheck the IBSS station limit before insertionZhao Li
Frames from successive unknown IBSS peers can make the deferred worker install more than 128 stations. The receive path checks local->num_sta before allocating each station, but pending stations are not included in that count. Several allocations can therefore pass before the worker inserts any of them, and the worker then drains the list without rechecking the limit. Recheck the installed-station limit in the worker under the wiphy mutex and free entries that no longer fit. LLM assistance was used to find the bug and review. Fixes: 8bf11d8d0811 ("mac80211: delay IBSS station insertion") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li <enderaoelyther@gmail.com> Link: https://patch.msgid.link/20261028142235.15428-2-enderaoelyther@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: reject invalid EHT guard intervals in airtime estimatesZhao Li
An invalid EHT guard interval can select the wrong airtime group and, at 320 MHz, read beyond airtime_mcs_groups. Guard interval 3 advances EHT_GROUP_IDX() into the next bandwidth group at narrower widths. With one spatial stream and 320 MHz, it evaluates to 264, one past the 264-entry table. RX rate parsing rejects the value, but the common TX-status validator has no EHT check and last_rate_info can carry it to the airtime helper. Reject values above NL80211_RATE_INFO_EHT_GI_3_2 in the helper. This also protects exported ieee80211_calc_rx_airtime() callers that do not pass through the TX-status validator. LLM assistance was used to find the bug and review. Fixes: 3702a33216e6 ("wifi: mac80211: introduce EHT rate support in AQL airtime") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li <enderaoelyther@gmail.com> Link: https://patch.msgid.link/20261028142212.14523-1-enderaoelyther@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: restore dormant links when link updates failZhao Li
A failed MLO link update can leave the interface with the requested dormant-links bitmap instead of its previous one. This can disable active links or trigger a bitmap warning during rollback. The error path restores the old valid-links bitmap but passes the new dormant_links argument to ieee80211_set_vif_links_bitmaps(). Save the old dormant bitmap before changing link state and use it when restoring the old configuration. LLM assistance was used to find the bug and review. Fixes: 6d543b34dbcf ("wifi: mac80211: Support disabled links during association") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li <enderaoelyther@gmail.com> Link: https://patch.msgid.link/20261028142123.13072-1-enderaoelyther@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: recheck injected headers after removing FCSZhao Li
Injecting a short frame with IEEE80211_RADIOTAP_F_FCS on a monitor interface can pass a truncated 802.11 header to transmit handlers. ieee80211_monitor_start_xmit() validates the linear 802.11 header before parsing radiotap. Radiotap parsing then removes the four-byte FCS without rechecking the remaining header length. Software encryption can subtract the larger header length and pass the resulting negative length as an unsigned size. Recheck the required linear header length after pulling the radiotap header and before handing the frame to the transmit path. Require at least addr1, which the transmit path reads even for extension frames whose header is shorter. LLM assistance was used to find the bug and review. Fixes: bddc0c411a45 ("mac80211: Fix NULL ptr deref for injected rate info") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li <enderaoelyther@gmail.com> Link: https://patch.msgid.link/20261028142101.11994-1-enderaoelyther@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: drain link readers before stopping removed linksZhao Li
Removing an MLO link can leave work queued on its link container after the container is freed. ieee80211_tear_down_links() stops each link before the RCU grace period. A reader that fetched the link earlier can therefore queue work after ieee80211_link_stop() has canceled it. ieee80211_request_smps() and ieee80211_csa_finish() can both reach this window. Record each removed link while removing its keys and debugfs state. Wait for RCU readers, then stop the recorded links so cancellation includes work queued by those readers. Free the detached keys after the grace period as before. LLM assistance was used to find the bug and review. Fixes: efe9c2bfd1a8 ("wifi: mac80211: isolate driver from inactive links") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li <enderaoelyther@gmail.com> Link: https://patch.msgid.link/20261028141708.5532-1-enderaoelyther@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: find STA for beacons belonging to non-TX BSSBenjamin Berg
Resolve the APs station in case a beacon is received for a non-transmitted BSS. This is important because the station has the key information for beacon protection. Without this change, mac80211 will not verify the beacon when connected to a non-transmitted BSSID. Most hardware is not affected as the frames are already verified. But for example the virtual hwsim driver is. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Link: https://patch.msgid.link/20261027144558.84c3f2f79b01.I055996ff039ab5c2f441c93190809e598dbea333@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: do not switch to invalid linkBenjamin Berg
Set the link_id in the SKB status to the invalid value of 0xf when the link ID is not valid. Also update the test in ieee80211_rx_handlers to correctly check this case. This avoids switching to an invalid link during RX of a single frame (when updating the link is not needed). It also means that the SKB link_id now has a more reasonable value as it is possible to differentiate the non-valid case from the case where the value is set to 0. Add back the appropriate checks before trying to use the link_id for access to arrays. These were removed in commit 4db13371e217 ("wifi: mac80211: refactor RX link_id and station handling"). Finally, this also fixes the link_sta lookup to use the correct link ID, rather than an old value from rx->link_id. Fixes: 2d03b83ef762 ("wifi: mac80211: fix non-MLD link ID handling") Fixes: 4db13371e217 ("wifi: mac80211: refactor RX link_id and station handling") Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Link: https://patch.msgid.link/20261027144558.7d7ed492e70a.Iaa63d80b6f13f871d1ee3cf1ce27118f72850ac0@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: fix use-after-free when MLO link setup is rolled backZhao Li
Rolling back an MLO link addition can free link containers while RCU readers still hold pointers to them. ieee80211_vif_update_links() publishes new links before checking for duplicate addresses and calling drv_change_vif_links(). If either fails, it restores the old pointers and frees the new containers without waiting for readers. During a non-MLO to MLO transition, the published link 0 replaces the deflink, so existing link 0 users can acquire the new container. Readers such as ieee80211_csa_finish() and ieee80211_obss_color_collision_notify() can also queue work embedded in the link. If they queue after ieee80211_link_stop() cancels that work, it remains queued when the container is freed. Wait for RCU readers after restoring the old pointers and before stopping the new links, so their work is queued before it is cancelled. Fixes: d3e2439b0f33 ("wifi: mac80211: fix link manipulation") Cc: stable@vger.kernel.org # 7.2.x Signed-off-by: Zhao Li <enderaoelyther@gmail.com> Link: https://patch.msgid.link/20261026152654.80697-1-enderaoelyther@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: abort chanswitch when leaving an IBSSMehmet Fide
ieee80211_ibss_disconnect() leaves CSA active, as ieee80211_stop_mesh() did until commit ac7472a24bd4 ("wifi: mac80211: abort chanswitch when leaving a mesh"). An IBSS left during its countdown and joined again refuses every new channel switch with -EBUSY. Abort the channel switch the same way. Fixes: cd7760e62c2a ("mac80211: add support for CSA in IBSS mode") Reported-by: Luka Gejak <luka.gejak@linux.dev> Closes: https://lore.kernel.org/linux-wireless/796598480d47c5bf474d11828769e864b8209558@linux.dev/ Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com> Reviewed-by: Luka Gejak <luka.gejak@linux.dev> Link: https://patch.msgid.link/20261025193615.1123718-1-mehmet.fide@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 dayswifi: mac80211: mesh: don't linearize SKBs unnecessarilyJohannes Berg
If mesh fast-xmit cannot be used due to aggregation not being fully set up yet, there's no need to linearize the SKB. Avoid that, which addresses a stale pointer issue in the caller. Change-Id: I6b93e6c7587faf8749f8366ed574ee2b79fd47a5 Fixes: 8b0f5cb6bc7c ("wifi: mac80211: use mesh header cache to speed up mesh forwarding") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-11-04Merge tag 'wireless-2026-11-02' of ↵Paolo Abeni
https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless Johannes Berg says: ==================== A few fixes to start with: - wext: fix notifier netns interaction - rsi: avoid TID OOB access - mac80211: reload pointer, fix A-MPDU flags - brcmfmac: fix DMA regression - cfg80211: fix regdb validation * tag 'wireless-2026-11-02' of https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless: wifi: mac80211: reinstate IEEE80211_TX_CTL_AMPDU flag in ieee80211_tx_prep_agg() wifi: cfg80211: fix out-of-bounds read in valid_rule() wifi: rsi: Skip TX aggregation setup for non-QoS frames wifi: wext: Limit notifier event flushes to the device's netns wifi: brcmfmac: map msgbuf RX packet IDs bidirectional wifi: mac80211: reload TDLS header pointer after skb_linearize() ==================== Link: https://patch.msgid.link/20261102104649.727621-3-johannes@sipsolutions.net Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-10-26wifi: mac80211: reinstate IEEE80211_TX_CTL_AMPDU flag in ieee80211_tx_prep_agg()Toke Høiland-Jørgensen
The commit 592234e941f1 ("wifi: mac80211: Fix iTXQ AMPDU fragmentation handling") changed the way handling of the IEEE80211_TX_CTL_AMPDU flag is done in mac80211, so the only place it is set is in ieee80211_tx_dequeue(). This means that any frames that are sent to the driver via drv_tx() will no longer have the flag set. In particular, this affects packets going through ieee80211_tx_pending(). Evan reported that this can result in the ath9k driver failing to account such packets in its block ack window, eventually overrunning the window and stalling TX. Fix this by reinstating the flag in ieee80211_tx_prep_agg() when inside a valid block ack window. This should be harmless for the TXQ path, and will reinstate the previous behaviour for drivers that use the flag as a signal to track the packet in the window. Fixes: 592234e941f1 ("wifi: mac80211: Fix iTXQ AMPDU fragmentation handling") Cc: stable@vger.kernel.org Reported-by: Evan Severson <eseverson@gmail.com> Link: https://lore.kernel.org/all/20261014025734.2288693-1-eseverson@gmail.com/ Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk> Tested-by: Evan Severson <eseverson@gmail.com> Link: https://patch.msgid.link/20261023110052.650519-1-toke@toke.dk Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-22wifi: mac80211: reload TDLS header pointer after skb_linearize()Weigang He
ieee80211_process_tdls_channel_switch() sets tf = skb->data before it calls skb_linearize(), and reads tf->action_code afterwards. ieee80211_rx_h_data() queues TDLS channel switch requests and responses to the interface after pulling only offsetof(struct ieee80211_tdls_data, u) bytes, so the skb can still be non-linear when the interface work handles it. Drivers that build paged RX skbs do this for every frame that does not fit into the skb head, e.g. iwlwifi (mvm), which is also the only mac80211 driver that sets NL80211_FEATURE_TDLS_CHANNEL_SWITCH. If the remaining data does not fit into the tailroom, skb_linearize() moves the data to a new head and frees the old one, and the action code is then read from freed memory. Depending on what that memory holds by then, the frame is handled as before or ends in the WARN_ON_ONCE() of the default case. The frame only has to be a data frame with the TDLS ethertype from an authorized peer, e.g. relayed by the AP from another station in the BSS; the read happens before the sender is checked to be a TDLS peer. Load tf after skb_linearize(), as the request and response handlers already do. Found by static analysis tool CodeQL. Fixes: 8a4d32f30d11 ("mac80211: add TDLS channel-switch Rx flow") Cc: stable@vger.kernel.org Assisted-by: LLM codeql Signed-off-by: Weigang He <geoffreyhe2@gmail.com> Link: https://patch.msgid.link/20261021145807.3018338-1-geoffreyhe2@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-21net: change netdev_hw_addr_list count through helpersYuyang Huang
The count of a netdev_hw_addr_list is changed in several places of dev_addr_lists.c and a few drivers read it directly. The next patch needs to account every change of the count of dev->mc. Add __hw_addr_count_add(), __hw_addr_count_inc(), __hw_addr_count_dec() and __hw_addr_count_reset(), use them for every change of the count and rename the field to _count so that a direct write stands out. Readers keep using netdev_hw_addr_list_count() and the netdev_uc_count() and netdev_mc_count() helpers, the few that read the field directly are converted. No functional change. Signed-off-by: Yuyang Huang <sigefriedhyy@gmail.com> Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Link: https://patch.msgid.link/20261012011707.3378-3-sigefriedhyy@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-10-14wifi: mac80211: tests: fix stack variable bugJohannes Berg
The code in mac80211 assumes that BSS entries are allocated together with the struct ieee80211_bss internal data, but the test didn't do that, which with clang 23 resulted in a KASAN splat here. Fix the code to properly have both structs. Fix the allocation while at it, should be the ies struct size, not the cbss. Link: https://patch.msgid.link/20261013151329.b8135eb40430.I97a6cb689fbc19903c78e2f6dfe37bdc2117b605@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: reserve MME tailroom for protected beaconsChien Wong
Beacon protection appends an MME to beacons, but the skb allocation does not reserve tailroom for it. If the available tailroom is too small, the crypto path drops the beacon. Two factors often mask this: the 256-byte TIM reservation is rarely fully used, and dev_alloc_skb() may round up the allocation, leaving extra tailroom. Neither guarantees enough room for the MME. Reserve enough room for the largest MME. Fixes: 0a3a84360b37 ("mac80211: Beacon protection using the new BIGTK (AP)") Signed-off-by: Chien Wong <m@xv97.com> Link: https://patch.msgid.link/20261012140738.70178-3-m@xv97.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: fix encryption tailroomChien Wong
BIP-CMAC-256 and BIP-GMAC append a 26-byte MME but mac80211 currently reserves only 18 bytes of encryption tailroom. Generating 26-byte MME may happen to work because the actual skb tailroom can exceed the requested amount. For example, dev_alloc_skb() rounds the allocation to kmalloc size buckets or alignment boundaries, and the extra space may cover the 8-byte shortfall. Reserve enough tailroom for the 26-byte MME. Fixes: 56c52da2d554 ("mac80111: Add BIP-CMAC-256 cipher") Signed-off-by: Chien Wong <m@xv97.com> Link: https://patch.msgid.link/20261012140738.70178-2-m@xv97.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: fix interface registration error path orderJohannes Berg
If we fail to register the inet/inet6 address notifiers, wiphy_unregister() is called before removing interface, but the default interface already exists at this point. This could also lead to a deadlock as wiphy_unregister() then waits for the interface to go away. Change the order to remove the interfaces first. Assisted-by: LLM Link: https://patch.msgid.link/20261011113308.c2cb32bf3160.Ib46993671ae3030950360ea378a507cef2bd4117@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: don't hold RTNL for rate control algoJohannes Berg
Back when we supported algorithm switching at runtime, this was needed for the open_count check. Now we don't have that any more, so the check and RTNL section can go away. Link: https://patch.msgid.link/20261011113308.0c5d35e2afea.I81141b28351e7c1ca23770616364346c33d7e08e@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: implement unlocked STA statisticsJohannes Berg
Implement the new cfg80211 unlocked STA statistics. If the driver has an operation, then we need to always do the locked again, so return -EAGAIN unconditionally if it has a locked but not atomic operation, but drivers can implement the new atomic methods to provide needed data atomically (and can also return -EAGAIN). This should, given a driver without any ops or adding the atomic ops, reduce wiphy mutex contention. Link: https://patch.msgid.link/20261009201417.706683ff9d81.Ieb92e4c6599a198a116fa6a4f7944219c6d32932@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: refactor station statisticsJohannes Berg
Refactor the code a bit to pass around link-STA pointers instead of looking them up again and again. This will simplify the next changes, since otherwise all of these lookups would have to be converted to RCU-safe ones. It also simplifies the code generally. Link: https://patch.msgid.link/20261009201417.32dfeaa3c44d.I7ea45bf80dd493311670f8fdd018b5c4b770a4be@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: don't require wiphy mutex for control port TXJohannes Berg
The wiphy mutex was only required for the cookie counter, but that's been in cfg80211 for a while. The rest is just datapath, so can work under RCU, just need to be careful to handle interface type changes. Link: https://patch.msgid.link/20261009201417.dffb8da303aa.Ica8bba30018704a7c776f2ef08e6f2571cd8f8c4@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: don't require wiphy mutex for probe_peerJohannes Berg
The comment about wiphy mutex is stale since the cookie cleanup, and everything else can be under RCU, we just have to drop the warning in case it races AP stop. Link: https://patch.msgid.link/20261009201417.4501c07ff31e.Ic87a72afcaea6b9a8c92f7f063bf33a2744a7992@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: implement mgmt_tx_unlocked()Johannes Berg
Implement the mgmt_tx_unlocked() method and accept frames that are transmitted on the operating channel with it, as they don't need further handling and can go out directly. For off-channel etc. just return -EAGAIN to fall back to the locked version. Link: https://patch.msgid.link/20261009201417.6491f3bdeb4e.Ib10158e2729f89719b551dadb8384e89b9dce688@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: refactor mgmt frames TXJohannes Berg
Refactor ieee80211_mgmt_tx() into on-channel and frame building helper functions so we can later implement the new mgmt_tx_unlocked() method. Link: https://patch.msgid.link/20261009201417.a84e223f4998.I4848c3eeb2aaf327712233f0bdb38bb48bdbbba6@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: implement lockless beacon updatesJohannes Berg
Implement the new update_beacon() method to update beacon and related templates without the wiphy mutex. If anything else were to change return -EAGAIN, same if there are any active countdowns, and during HW restart. Eventually, the idea is to replace countdowns by beacon update requests so hostapd can handle everything instead. This doesn't enable it for any drivers since it depends on the driver behaviour, if it fetches each beacon and doesn't use the other templates it can just set the feature flag (NL80211_EXT_FEATURE_UPDATE_BEACON), otherwise it must implement the new update_beacon() mac80211 method. The regular beacon update may need to take head, tail and MBSSID/RNR elements from the old beacon, so while that's going on mark "bss_update_in_progress" and make lockless updates return -EAGAIN during that time, so that the old data remains valid/identical. For MBSSID, the lockless path also can't copy old data, so that also has to return -EAGAIN. All those -EAGAIN cases fall back to cfg80211 and do the update with the lock held, where it can then be handled. Userspace should ideally ensure it doesn't hit that path. Assisted-by: LLM Link: https://patch.msgid.link/20261009201417.a9433ea65d8e.Icfbcd157ac2bdeccfcc74a9f4c3997d3010ec0a9@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: refactor beacon allocationJohannes Berg
Refactor allocating/filling beacon data to a new function, so we can reuse it for lockless beacon updates. Also split out the bssid_indicator calculation, lockless updates will need to ensure it didn't change. Assisted-by: LLM Link: https://patch.msgid.link/20261009201417.ba48af051dfa.If468a87e4c71f8fe8d0f467525a86e7921496e9a@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-13wifi: mac80211: protect AP template pointers with a spinlockJohannes Berg
The AP's beacon, presp etc. templates are only updated under wiphy mutex right now. Prepare for being able to update them without the wiphy mutex by using a (per-link) spinlock for them. Link: https://patch.msgid.link/20261009201417.f9414c150e5d.Iba8a15c4d37e441642b6df68c33ef8c97340e9a9@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: use link address as TA for non-MLO 4-addr station on MLD APFelix Fietkau
A 4-address AP_VLAN always sets A2 to sdata->vif.addr, which on an MLD AP is the AP MLD address. For a non-MLO station, A2 must be the link address it associated to. Use the link address for a non-MLO station in the 4-address case as well, like the AP case already does in ieee80211_build_hdr() and ieee80211_check_fast_xmit(). Share the address selection between both cases and both TX paths. Fixes: 3e0278b717b0 ("wifi: mac80211: select link when transmitting to non-MLO stations") Signed-off-by: Felix Fietkau <nbd@nbd.name> Link: https://patch.msgid.link/20261007105249.1234601-1-nbd@nbd.name [use guard] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: Pin module for hwflags debugfs file operationsBui Viet Dung
An open debugfs file retains its file_operations pointer in the debugfs proxy state. However, hwflags_ops in net/mac80211/debugfs.c has no .owner set to THIS_MODULE. As a result, full_proxy_open_regular() calls fops_get() which succeeds without taking a reference to the mac80211 module. When CONFIG_MAC80211=m and wireless debugfs is enabled, a userspace process can open the hwflags debugfs file and keep the file descriptor open while the module is unloaded (rmmod mac80211). When the userspace process subsequently closes the descriptor, full_proxy_release() accesses the already unmapped file_operations structure, triggering a kernel oops in full_proxy_release(): BUG: unable to handle page fault for address: fffffbfff8056f03 #PF: supervisor read access in kernel mode Oops: 0000 [#1] SMP KASAN NOPTI RIP: 0010:full_proxy_release+0x8e/0x140 Call Trace: <TASK> __fput+0x39f/0xa60 fput_close_sync+0xff/0x200 __x64_sys_close+0x8c/0xf0 do_syscall_64+0x115/0x6a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> The issue was discovered via manual code audit of net/mac80211/debugfs.c. Set .owner = THIS_MODULE on hwflags_ops so that debugfs pins the module until all open file descriptors have been closed. Signed-off-by: Bui Viet Dung <dungvn2345@gmail.com> Link: https://patch.msgid.link/20261008052412.541780-1-dungvn2345@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: set conn mode prior to parsing elements in beaconLachlan Hodges
ieee80211_inform_bss() currently calls ieee802_11_parse_elems to parse the beacon elements, which internally sets the params->mode to IEEE80211_CONN_MODE_HIGHEST. This means any S1G specific parsing is bypassed entirely (in the beacon case it is the shorter TIM) and the beacon is marked as corrupt: wlan0: operating as S1G STA wlan0: associating to AP 0c:bf:74:00:30:fd with corrupt beacon wlan0: associate with 0c:bf:74:00:30:fd (try 1/3) In this case, we can simply call ieee802_11_parse_elems_full and build the params locally (similar to most mlme paths) such that we can set the conn mode to ensure the S1G specific parsing occurs. Once this is done, the beacon is no longer considered corrupt: wlan0: operating as S1G STA wlan0: associate with 0c:bf:74:00:30:fd (try 1/3) Signed-off-by: Lachlan Hodges <lachlan.hodges@morsemicro.com> Link: https://patch.msgid.link/20261008030939.474493-3-lachlan.hodges@morsemicro.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: handle shorter S1G TIM when parsing elementsLachlan Hodges
An S1G TIM, unlike the regular TIM, can exclude both the bitmap control and the PVB. As a result it's minimum length is actually 2. Fix this by allowing a shorter TIM for S1G connections. Suggested-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Lachlan Hodges <lachlan.hodges@morsemicro.com> Link: https://patch.msgid.link/20261008030939.474493-2-lachlan.hodges@morsemicro.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: fix TDLS setup frame length checkJohannes Berg
If TDLS setup packets are created by AF_PACKET or so, then the payload may not be present. Since we only care about those mac80211 generated (which are linear), just replace the skb->len check with a skb_headlen() check to avoid any out-of-bounds accesses. Assisted-by: LLM Link: https://patch.msgid.link/20261005224950.c3cf023d5191.Id537db8aca13e6df999938a3bc4cc6ce2a28f733@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: don't read runt headers in injectionJohannes Berg
For injection we only check the header is in the skb head, but e.g. ACK/CTS are really short, and we then try to use A2 anyway. Require A1 (no S1G extension frames) and use A2 only when present. Assisted-by: LLM Link: https://patch.msgid.link/20261005224950.0f3c3e88abde.I03477f2444a9f2cb2888d00320ac7c4504f150a3@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: fix mbssid/rnr allocation in beacon dataJohannes Berg
These structs are placed after the tail, but that can make them unaligned. Change the order so the structs are after one another, and then followed by the head/tail/elements. Assisted-by: LLM Fixes: 2b3171c6fe0a ("mac80211: MBSSID beacon handling in AP mode") Link: https://patch.msgid.link/20261005224950.2f554b2c7c10.Ie961eb6b1435f956446e052936258758b966c67f@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: mesh: fix path table generation countersJohannes Berg
The mesh and MPP path generation counters (for netlink) are updated wrongly and sometimes unlocked. Fix those issues. Assisted-by: LLM Link: https://patch.msgid.link/20261005224950.373dd5c1e46a.I29b95bc3f62b846084700599a261a203a6e459b4@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: limit injected HT/VHT MCSesJohannes Berg
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 <johannes.berg@intel.com>
2026-10-09wifi: mac80211: init radiotap iter after length checksJohannes Berg
The radiotap iterator initialization will already parse the presence bitmaps, so it accesses a good part of the header. This might not be present in the linear part of the SKB, we haven't checked it at this point. Check the lengths first. Assisted-by: LLM Fixes: cb17ed29a7a5 ("mac80211: parse radiotap header when selecting Tx queue") Link: https://patch.msgid.link/20261005224950.b5c2c31790d2.I091422db411b595bde4dba2de69334cd2aeb33b0@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: kill wake_txqs_tasklet on unregistrationJohannes Berg
We never kill the wake_txqs_tasklet so it could be running while the hardware is being freed. Kill it, late enough to never be able to restart afterwards. Assisted-by: LLM Fixes: 21a5d4c3a45c ("mac80211: add stop/start logic for software TXQs") Link: https://patch.msgid.link/20261005224950.3fdb8d0ff377.I851e79ac625c4926e211642ee7a7e458728b0ad3@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: mesh: use hlist_add_head_rcu()Johannes Berg
The mesh paths walk list used under RCU, so we must use hlist_add_head_rcu() to publish an entry. Fix one place that didn't do that. Assisted-by: LLM Fixes: b4c3fbe63601 ("mac80211: Use linked list instead of rhashtable walk for mesh tables") Link: https://patch.msgid.link/20261005224950.e0db543145e1.Ieaf30d3546e8ff63ccf400f6fb26e027c218721f@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-09wifi: mac80211: clear fragment cache entry 'is_protected'Johannes Berg
In practice, we probably shouldn't end up with a fragmented frame that's protected, filled into the cache, finished or dropped and then the next frame is unprotected, since only unicast data frames can be fragmented. However, tools complain and it's more correct to be able to do this (e.g. an unencrypted fragmented EAPOL _could_, at least in theory, happen), so clear the flag when the entry is reused. Assisted-by: LLM Fixes: 7e44a0b597f0 ("mac80211: prevent attacks on TKIP/WEP as well") Link: https://patch.msgid.link/20261005224950.c3e4106f34d5.I866c0862db031c3a810d2333acdd22e2733d2b8c@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-08Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.3-rc7). Conflicts: include/net/strparser.h 0984ebc631792 ("strparser: make sure __strp_recv isn't running before tearing down the parser") 02fd0a2111374 ("net: strparser: removed the aborted bit and aborts counter") https://lore.kernel.org/asYfmLsfy-SCxXjr@sirena.co.uk Adjacent changes: Documentation/networking/strparser.rst 5f193cdabf25 ("docs: networking: strparser: remove general mode") 0984ebc63179 ("strparser: make sure __strp_recv isn't running before tearing down the parser") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-10-07wifi: mac80211: don't estimate airtime for unsupported rate widthsFrançois Roux
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: 094dc1619cb0 ("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-06wifi: mac80211: use the AP address as RA for a 4-addr MLO stationFelix Fietkau
In 4-address mode, ieee80211_build_hdr() and ieee80211_check_fast_xmit() set A1 to sdata->deflink.u.mgd.bssid, which is not valid for an MLO connection. Use sdata->vif.cfg.ap_addr instead, like the 3-address case does. Signed-off-by: Felix Fietkau <nbd@nbd.name> Link: https://patch.msgid.link/20260930084819.3000572-2-nbd@nbd.name Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-10-06wifi: mac80211: acquire wiphy lock for unlisted sdata teardownRaj Ojha
When netdev registration fails or an interface cannot be moved out of a dying network namespace, the netdev core calls ->ndo_uninit() (ieee80211_uninit) with RTNL held. However, ieee80211_uninit() calls ieee80211_teardown_sdata() without holding wiphy_lock. During teardown, ieee80211_free_keys() invokes wiphy_delayed_work_cancel(), which triggers a lockdep warning: WARNING: CPU: 0 PID: 6112 at net/wireless/core.c:1839 wiphy_delayed_work_cancel+0x85/0xb0 ... Call Trace: ieee80211_free_keys+0x31a/0x3c0 net/mac80211/key.c:380 ieee80211_teardown_sdata+0x2b8/0x10f0 net/mac80211/iface.c:928 ieee80211_uninit+0x3f/0x50 net/mac80211/iface.c:954 rollback_registered_many+0xa5c/0xef0 net/core/dev.c:10065 In the normal deletion path (ieee80211_del_virtual_intf), both RTNL and wiphy_lock are held when ieee80211_teardown_sdata() runs, and the sdata is removed from local->interfaces. Change ieee80211_unlist_sdata() to return a boolean indicating whether the sdata was present in the list, and acquire wiphy_lock in ieee80211_uninit() only if the interface is actually being unlisted here. Reported-by: syzbot+e9cbd080a7801f06cf08@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=e9cbd080a7801f06cf08 Tested-by: syzbot+e9cbd080a7801f06cf08@syzkaller.appspotmail.com Signed-off-by: Raj Ojha <rajojha047@gmail.com> Link: https://patch.msgid.link/20261003112741.52-1-rajojha047@gmail.com [dissolve ieee80211_unlist_sdata() to avoid weird locking] Signed-off-by: Johannes Berg <johannes.berg@intel.com>