linux-stable/drivers/staging/rtl8192u/ieee80211
Duoming Zhou ffc9cab724 drivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop()
[ Upstream commit 806c7b5341 ]

There is a deadlock in ieee80211_beacons_stop(), which is shown below:

   (Thread 1)              |      (Thread 2)
                           | ieee80211_send_beacon()
ieee80211_beacons_stop()   |  mod_timer()
 spin_lock_irqsave() //(1) |  (wait a time)
 ...                       | ieee80211_send_beacon_cb()
 del_timer_sync()          |  spin_lock_irqsave() //(2)
 (wait timer to stop)      |  ...

We hold ieee->beacon_lock in position (1) of thread 1 and use
del_timer_sync() to wait timer to stop, but timer handler
also need ieee->beacon_lock in position (2) of thread 2.
As a result, ieee80211_beacons_stop() will block forever.

This patch extracts del_timer_sync() from the protection of
spin_lock_irqsave(), which could let timer handler to obtain
the needed lock.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220417135407.109536-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-14 18:41:34 +02:00
..
dot11d.c staging/rtl8192u/ieee80211: remove debugging line 2020-10-26 06:53:10 +01:00
dot11d.h
ieee80211.h staging: rtl8192u: Avoid field-overflowing memcpy() 2021-08-10 12:09:35 +02:00
ieee80211_crypt.c
ieee80211_crypt.h
ieee80211_crypt_ccmp.c staging: rtl8192u: Avoid field-overflowing memcpy() 2021-08-10 12:09:35 +02:00
ieee80211_crypt_tkip.c mm: remove kzfree() compatibility definition 2020-10-25 11:39:02 -07:00
ieee80211_crypt_wep.c mm: remove kzfree() compatibility definition 2020-10-25 11:39:02 -07:00
ieee80211_module.c
ieee80211_rx.c staging: rtl8192u: Avoid field-overflowing memcpy() 2021-08-10 12:09:35 +02:00
ieee80211_softmac.c drivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop() 2022-06-14 18:41:34 +02:00
ieee80211_softmac_wx.c staging: rtl8192u: Switch from strlcpy to strscpy 2021-02-04 17:16:07 +01:00
ieee80211_tx.c staging: rtl8192u: Fix shadowed variable name 2021-06-03 15:56:54 +02:00
ieee80211_wx.c staging: rtl8192u: ieee80211: Remove braces for single line blocks 2021-03-12 17:31:28 +01:00
rtl819x_BA.h
rtl819x_BAProc.c staging: rt8192u: change constants to be on right 2021-04-07 10:21:44 +02:00
rtl819x_HT.h
rtl819x_HTProc.c
rtl819x_Qos.h
rtl819x_TS.h
rtl819x_TSProc.c