mirror-linux/drivers/net/wireless
Johannes Berg 313bbd1990 mac80211-hwsim: fix late beacon hrtimer handling
Thomas explained in https://lore.kernel.org/r/87mtoeb4hb.ffs@tglx
that our handling of the hrtimer here is wrong: If the timer fires
late (e.g. due to vCPU scheduling, as reported by Dmitry/syzbot)
then it tries to actually rearm the timer at the next deadline,
which might be in the past already:

 1          2          3          N          N+1
 |          |          |   ...    |          |

 ^ intended to fire here (1)
            ^ next deadline here (2)
                                      ^ actually fired here

The next time it fires, it's later, but will still try to schedule
for the next deadline (now 3), etc. until it catches up with N,
but that might take a long time, causing stalls etc.

Now, all of this is simulation, so we just have to fix it, but
note that the behaviour is wrong even per spec, since there's no
value then in sending all those beacons unaligned - they should be
aligned to the TBTT (1, 2, 3, ... in the picture), and if we're a
bit (or a lot) late, then just resume at that point.

Therefore, change the code to use hrtimer_forward_now() which will
ensure that the next firing of the timer would be at N+1 (in the
picture), i.e. the next interval point after the current time.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Reported-by: syzbot+0e964fad69a9c462bc1e@syzkaller.appspotmail.com
Fixes: 01e59e467e ("mac80211_hwsim: hrtimer beacon")
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210915112936.544f383472eb.I3f9712009027aa09244b65399bf18bf482a8c4f1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-09-23 13:25:12 +02:00
..
admtek
ath ARM: SoC drivers for 5.15 2021-09-01 15:25:28 -07:00
atmel
broadcom brcmfmac: pcie: fix oops on failure to resume and reprobe 2021-08-29 14:45:29 +03:00
cisco airo: use ndo_siocdevprivate 2021-07-27 20:11:44 +01:00
intel Networking stragglers and fixes for 5.15-rc1, including changes from netfilter, 2021-09-07 14:02:58 -07:00
intersil Kbuild updates for v5.15 2021-09-03 15:33:47 -07:00
marvell mwifiex: pcie: add reset_d3cold quirk for Surface gen4+ devices 2021-08-29 14:46:41 +03:00
mediatek wireless-drivers fixes for v5.14 2021-08-17 15:08:14 -07:00
microchip wilc1000: Convert module-global "isinit" to device-specific variable 2021-08-29 11:33:36 +03:00
quantenna qtnfmac: switch from 'pci_' to 'dma_' API 2021-08-23 11:56:57 +01:00
ralink
realtek rtlwifi: rtl8192de: Fix initialization of place in _rtl92c_phy_get_rightchnlplace() 2021-08-29 10:28:32 +03:00
rsi rsi: make array fsm_state static const, makes object smaller 2021-08-29 11:32:01 +03:00
st
ti Driver core changes for 5.14-rc1 2021-07-05 13:51:41 -07:00
zydas
Kconfig
Makefile
mac80211_hwsim.c mac80211-hwsim: fix late beacon hrtimer handling 2021-09-23 13:25:12 +02:00
mac80211_hwsim.h
ray_cs.c ray_cs: Split memcpy() to avoid bounds check warning 2021-08-21 20:15:36 +03:00
ray_cs.h
rayctl.h
rndis_wlan.c
virt_wifi.c virt_wifi: fix error on connect 2021-07-23 10:34:31 +02:00
wl3501.h
wl3501_cs.c