staging: rtl8723bs: Fix two sleep-in-atomic-context bugs in _rtw_pwr_wakeup()
authorJia-Ju Bai <baijiaju1990@gmail.com>
Sat, 15 Sep 2018 02:49:44 +0000 (10:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Sep 2018 11:29:11 +0000 (13:29 +0200)
commit8204b61a775879acaa4ec67fc5f92985238cc27d
tree7b9680a4807c05313189fb52cf831c8379b2f629
parent1c8cb89ee9f8c0785bc1437f14ad01304acd91aa
staging: rtl8723bs: Fix two sleep-in-atomic-context bugs in _rtw_pwr_wakeup()

The driver may sleep with holding a spinlock.
The function call paths (from bottom to top) in Linux-4.17 are:

[FUNC] msleep
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c, 1243:
msleep in _rtw_pwr_wakeup
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c, 510:
_rtw_pwr_wakeup in rtw_set_802_11_disassociate
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c, 501:
spin_lock_bh in rtw_set_802_11_disassociate

[FUNC] msleep
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c, 1255:
msleep in _rtw_pwr_wakeup
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c, 510:
_rtw_pwr_wakeup in rtw_set_802_11_disassociate
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c, 501:
spin_lock_bh in rtw_set_802_11_disassociate

To fix these bugs, msleep() is replaced with mdelay().

These bugs are found by my static analysis tool DSAC.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c