opnsense-src/sys/net80211
Bjoern A. Zeeb 8d6b758199 net80211: fix a race between ieee80211_sta_join and scan entries
We were seeing panics during ieee80211_sta_join() which seemed that
the ni->ni_chan was not valid anymore, which was true.
We also saw errors indicating data put into ni_ies became inalid.

The problem was that the ieee80211_scan_entry passed into
ieee80211_sta_join() (in the observed case from setmlme_assoc_sta())
became invalid during ieee80211_alloc_node().
As a result for the ni_chan case the the rateset and len in rates[1]
became invalid.  Similarly for the IEs.

Make a (deep)copy of the scan entry in setmlme_assoc_sta() and return
the copy as once we leave ieee80211_scan_iterate() we can no longer
rely on the scan entry to be valid.

Sponsored by:	The FreeBSD Foundation
Reported by:	rm, ziaee, bz
Tested by:	rm, ziaee, bz
PR:		286063
Approved by:	re (cperciva)
Reviewed by:	adrian (,emaste)
Differential Revision: https://reviews.freebsd.org/D49865

(cherry picked from commit aff56b4f0b25c44c9c2cae9a3f816c4277057a71)
(cherry picked from commit 34cd36918652f07ea8a36a62115349781e457fc6)
2025-05-08 21:22:59 +00:00
..
_ieee80211.h net80211; LinuxKPI 802.11: introduce IEEE80211_RX_F_ICV_STRIP 2025-04-29 10:49:28 +00:00
ieee80211.c net80211: add driver / crypto methods to set the hardware / software cipher suites 2025-04-29 10:49:28 +00:00
ieee80211.h net80211: rename \4 in IEEE80211_VHTCAP_BITS for clarity 2025-02-24 20:26:47 +00:00
ieee80211_acl.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_action.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_action.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_adhoc.c net80211: scan/internal: change boolean argument from int to bool 2024-09-28 10:35:12 +00:00
ieee80211_adhoc.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_ageq.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_ageq.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_alq.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_alq.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_amrr.c net80211: amrr_init: change order of commands 2024-04-22 17:00:22 +00:00
ieee80211_amrr.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
ieee80211_crypto.c net80211: add driver / crypto methods to set the hardware / software cipher suites 2025-04-29 10:49:28 +00:00
ieee80211_crypto.h net80211: add driver / crypto methods to set the hardware / software cipher suites 2025-04-29 10:49:28 +00:00
ieee80211_crypto_ccmp.c net80211: LinuxKPI 802.11: clean up MIC vs. MMIC rx flags 2025-03-19 22:22:15 +00:00
ieee80211_crypto_none.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_crypto_tkip.c net80211; LinuxKPI 802.11: introduce IEEE80211_RX_F_ICV_STRIP 2025-04-29 10:49:28 +00:00
ieee80211_crypto_wep.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_ddb.c net80211 / LinuxKPI 802.11: use enum ieee80211_sta_rx_bw for ni_chw 2025-02-10 14:52:08 +00:00
ieee80211_dfs.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_dfs.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_freebsd.c net80211: cleanup keyidx argument of ieee80211_notify_michael_failure() 2025-04-18 14:35:58 +00:00
ieee80211_freebsd.h net80211: add IEEE80211_IS_LOCKED() 2025-02-10 14:52:09 +00:00
ieee80211_hostap.c net80211: scan/internal: change boolean argument from int to bool 2024-09-28 10:35:12 +00:00
ieee80211_hostap.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_ht.c net80211: (v)ht: use macros at hand 2025-02-10 14:52:09 +00:00
ieee80211_ht.h net80211: HT: add missing bit descriptions for IEEE80211_AGGR_BITS 2025-02-10 14:52:08 +00:00
ieee80211_hwmp.c net80211: Fix a typo in a source code comment 2024-01-25 07:47:45 +01:00
ieee80211_input.c net80211: adjust more VHT structures/fields 2024-02-18 18:31:15 +00:00
ieee80211_input.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_ioctl.c net80211: fix a race between ieee80211_sta_join and scan entries 2025-05-08 21:22:59 +00:00
ieee80211_ioctl.h net80211: add a new field specifically for announcing specific ciphers 2025-04-29 10:49:28 +00:00
ieee80211_mesh.c net80211: scan/internal: change boolean argument from int to bool 2024-09-28 10:35:12 +00:00
ieee80211_mesh.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
ieee80211_monitor.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_monitor.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_node.c net80211: Fix IEEE80211_KEY_UNDEFINED() in ieee80211_node_delucastkey() 2025-03-19 22:22:15 +00:00
ieee80211_node.h net80211: fill in missing flags to IEEE80211_NODE_BITS 2025-04-18 14:35:59 +00:00
ieee80211_output.c net80211: add IEEE80211_CONF_AMPDU_OFFLOAD for AMPDU[-TX] offload 2025-04-29 10:49:28 +00:00
ieee80211_phy.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_phy.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_power.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_power.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_proto.c net80211: deal with lost state transitions 2024-02-18 18:31:17 +00:00
ieee80211_proto.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_radiotap.c net80211: Correct a comment 2024-06-25 12:25:31 +08:00
ieee80211_radiotap.h net8011: radiotap: add more EHT constants 2024-04-22 16:59:49 +00:00
ieee80211_ratectl.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_ratectl.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_ratectl_none.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_regdomain.c net80211: migrate ic_vhtcaps, ic_vht_mcsinfo, ic_flags_vht 2023-11-30 00:36:58 +00:00
ieee80211_regdomain.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_rssadapt.c sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
ieee80211_rssadapt.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
ieee80211_scan.c net80211: scan/internal: change boolean argument from int to bool 2024-09-28 10:35:12 +00:00
ieee80211_scan.h net80211: scan/internal: change boolean argument from int to bool 2024-09-28 10:35:12 +00:00
ieee80211_scan_sta.c net80211: rename iv_flags_vht to iv_vht_flags 2023-11-30 00:36:58 +00:00
ieee80211_scan_sw.c net80211: scan/internal: change boolean argument from int to bool 2024-09-28 10:35:12 +00:00
ieee80211_scan_sw.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_sta.c net80211 / LinuxKPI 802.11: use enum ieee80211_sta_rx_bw for ni_chw 2025-02-10 14:52:08 +00:00
ieee80211_sta.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_superg.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_superg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_tdma.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_tdma.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_var.h net80211: add IEEE80211_CONF_AMPDU_OFFLOAD for AMPDU[-TX] offload 2025-04-29 10:49:28 +00:00
ieee80211_vht.c net80211: 11ac: add options to manage VHT STBC 2025-02-10 14:52:08 +00:00
ieee80211_vht.h net80211: adjust more VHT structures/fields 2024-02-18 18:31:15 +00:00
ieee80211_wds.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_wds.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_wps.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_xauth.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00