freebsd-src/sys/net80211
Bjoern A. Zeeb 713db49d06 net80211: deal with lost state transitions
Since 5efea30f03 we can possibly lose a state transition which can
cause trouble further down the road.
The reproducer from 643d6dce6c can trigger these for example.
Drivers for firmware based wireless cards have worked around some of
this (and other) problems in the past.

Add an array of tasks rather than a single one as we would simply
get npending > 1 and lose order with other tasks.  Try to keep state
changes updated as queued in case we end up with more than one at a
time.  While this is not ideal either (call it a hack) it will sort
the problem for now.
We will queue in ieee80211_new_state_locked() and do checks there
and dequeue in ieee80211_newstate_cb().
If we still overrun the (currently) 8 slots we will drop the state
change rather than overwrite the last one.
When dequeing we will update iv_nstate and keep it around for historic
reasons for the moment.

The longer term we should make the callers of
ieee80211_new_state[_locked]() actually use the returned errors
and act appropriately but that will touch a lot more places and
drivers (possibly incl. changed behaviour for ioctls).

rtwn(4) and rum(4) should probably be revisted and net80211 internals
removed (for rum(4) at least the current logic still seems prone to
races).

PR:		271979, 271988, 275255, 263613, 274003
Sponsored by:	The FreeBSD Foundation (in 2023)
MFC after:	3 days
Reviewed by:	cc
Differential Revision: https://reviews.freebsd.org/D43389
2024-02-14 19:47:21 +00:00
..
_ieee80211.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211.c net80211: deal with lost state transitions 2024-02-14 19:47:21 +00:00
ieee80211.h net80211: adjust more VHT structures/fields 2023-12-22 00:20:19 +00:00
ieee80211_acl.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_action.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ieee80211_action.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_adhoc.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07: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: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ieee80211_alq.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_amrr.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_amrr.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
ieee80211_crypto.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_crypto.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_crypto_ccmp.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_crypto_none.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_crypto_tkip.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_crypto_wep.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_ddb.c net80211: deal with lost state transitions 2024-02-14 19:47:21 +00:00
ieee80211_dfs.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ieee80211_dfs.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_freebsd.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_freebsd.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_hostap.c net80211: adjust more VHT structures/fields 2023-12-22 00:20:19 +00:00
ieee80211_hostap.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_ht.c sys: Use mbufq_empty instead of comparing mbufq_len against 0 2024-01-09 11:00:46 -08:00
ieee80211_ht.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_hwmp.c net80211: Fix a typo in a source code comment 2024-01-22 21:54:36 +01:00
ieee80211_input.c net80211: adjust more VHT structures/fields 2023-12-22 00:20:19 +00:00
ieee80211_input.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_ioctl.c ieee80211: Check for copyout() errors in the SIOCG80211STATS handler 2023-12-18 22:44:54 -05:00
ieee80211_ioctl.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_mesh.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ieee80211_mesh.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
ieee80211_monitor.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ieee80211_monitor.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_node.c net80211: make sure calls to (*iv_update_bss)() are locked 2024-02-03 13:55:29 +00:00
ieee80211_node.h net80211: de-inline ieee80211_ref_node() 2023-10-05 14:56:02 +00:00
ieee80211_output.c net80211: adjust more VHT structures/fields 2023-12-22 00:20:19 +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-14 19:47:21 +00:00
ieee80211_proto.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_radiotap.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_radiotap.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
ieee80211_ratectl.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07: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-03 21:08:04 +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 sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ieee80211_scan.h net80211: improve scan debugging 2023-09-14 21:20:54 +00:00
ieee80211_scan_sta.c net80211: rename iv_flags_vht to iv_vht_flags 2023-11-03 21:08:04 +00:00
ieee80211_scan_sw.c net80211: introduce two extra ieee80211_notify_scan_done() 2023-09-21 17:37:55 +00:00
ieee80211_scan_sw.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_sta.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07: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: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ieee80211_tdma.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee80211_var.h net80211: deal with lost state transitions 2024-02-14 19:47:21 +00:00
ieee80211_vht.c net80211: adjust more VHT structures/fields 2023-12-22 00:20:19 +00:00
ieee80211_vht.h net80211: adjust more VHT structures/fields 2023-12-22 00:20:19 +00:00
ieee80211_wds.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07: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