diff options
author | Yan-Hsuan Chuang <yhchuang@realtek.com> | 2020-02-05 15:08:56 +0800 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2020-02-12 18:18:28 +0200 |
commit | 6eab0ba99bc2c8659ee310bbc614374ebf769ff1 (patch) | |
tree | d4b81ce5f77c738c8b5acf026395c40d53e1d6c0 /drivers/net/wireless/realtek/rtw88/fw.c | |
parent | 398b9bdab2c351c4386a4c060e5922c47ebde691 (diff) | |
download | lwn-6eab0ba99bc2c8659ee310bbc614374ebf769ff1.tar.gz lwn-6eab0ba99bc2c8659ee310bbc614374ebf769ff1.zip |
rtw88: avoid holding mutex for cancel_delayed_work_sync()
Driver could possibly be dead-locked while canceling works with
*_sync() with mutex lock held. Those cancel_delayed_work_sync()
functions will wait until the work is done, but if we hold the
lock, they will never acquire the lock.
To prevent this, simply release the lock and acquire again after
the works have been canceled. And to avoid the works being queued
again, check if the device is at RTW_FLAG_RUNNING state, otherwise
just return and do nothing.
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/realtek/rtw88/fw.c')
-rw-r--r-- | drivers/net/wireless/realtek/rtw88/fw.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c index b765b26b6926..b36928470fc0 100644 --- a/drivers/net/wireless/realtek/rtw88/fw.c +++ b/drivers/net/wireless/realtek/rtw88/fw.c @@ -136,6 +136,9 @@ void rtw_fw_c2h_cmd_handle(struct rtw_dev *rtwdev, struct sk_buff *skb) mutex_lock(&rtwdev->mutex); + if (!test_bit(RTW_FLAG_RUNNING, rtwdev->flags)) + goto unlock; + switch (c2h->id) { case C2H_BT_INFO: rtw_coex_bt_info_notify(rtwdev, c2h->payload, len); @@ -153,6 +156,7 @@ void rtw_fw_c2h_cmd_handle(struct rtw_dev *rtwdev, struct sk_buff *skb) break; } +unlock: mutex_unlock(&rtwdev->mutex); } |