In the Linux kernel, the following vulnerability has been resolved:
drivers: staging: rtl8192u: Fix deadlock in ieee80211beaconsstop()
There is a deadlock in ieee80211beaconsstop(), which is shown below:
(Thread 1) | (Thread 2) | ieee80211sendbeacon() ieee80211beaconsstop() | modtimer() spinlockirqsave() //(1) | (wait a time) ... | ieee80211sendbeaconcb() deltimersync() | spinlockirqsave() //(2) (wait timer to stop) | ...
We hold ieee->beaconlock in position (1) of thread 1 and use deltimersync() to wait timer to stop, but timer handler also need ieee->beaconlock in position (2) of thread 2. As a result, ieee80211beaconsstop() will block forever.
This patch extracts deltimersync() from the protection of spinlockirqsave(), which could let timer handler to obtain the needed lock.