qlcnic: fix sleep-in-atomic-context bugs caused by msleep
[ Upstream commit8dbd6e4ce1] The watchdog timer is used to monitor whether the process of transmitting data is timeout. If we use qlcnic driver, the dev_watchdog() that is the timer handler of watchdog timer will call qlcnic_tx_timeout() to process the timeout. But the qlcnic_tx_timeout() calls msleep(), as a result, the sleep-in-atomic-context bugs will happen. The processes are shown below: (atomic context) dev_watchdog qlcnic_tx_timeout qlcnic_83xx_idc_request_reset qlcnic_83xx_lock_driver msleep --------------------------- (atomic context) dev_watchdog qlcnic_tx_timeout qlcnic_83xx_idc_request_reset qlcnic_83xx_lock_driver qlcnic_83xx_recover_driver_lock msleep Fix by changing msleep() to mdelay(), the mdelay() is busy-waiting and the bugs could be mitigated. Fixes:629263acae("qlcnic: 83xx CNA inter driver communication mechanism") Signed-off-by: Duoming Zhou <duoming@zju.edu.cn> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d753f554f2
commit
fa59d49a49
@@ -2991,7 +2991,7 @@ static void qlcnic_83xx_recover_driver_lock(struct qlcnic_adapter *adapter)
|
|||||||
QLCWRX(adapter->ahw, QLC_83XX_RECOVER_DRV_LOCK, val);
|
QLCWRX(adapter->ahw, QLC_83XX_RECOVER_DRV_LOCK, val);
|
||||||
dev_info(&adapter->pdev->dev,
|
dev_info(&adapter->pdev->dev,
|
||||||
"%s: lock recovery initiated\n", __func__);
|
"%s: lock recovery initiated\n", __func__);
|
||||||
msleep(QLC_83XX_DRV_LOCK_RECOVERY_DELAY);
|
mdelay(QLC_83XX_DRV_LOCK_RECOVERY_DELAY);
|
||||||
val = QLCRDX(adapter->ahw, QLC_83XX_RECOVER_DRV_LOCK);
|
val = QLCRDX(adapter->ahw, QLC_83XX_RECOVER_DRV_LOCK);
|
||||||
id = ((val >> 2) & 0xF);
|
id = ((val >> 2) & 0xF);
|
||||||
if (id == adapter->portnum) {
|
if (id == adapter->portnum) {
|
||||||
@@ -3027,7 +3027,7 @@ int qlcnic_83xx_lock_driver(struct qlcnic_adapter *adapter)
|
|||||||
if (status)
|
if (status)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
msleep(QLC_83XX_DRV_LOCK_WAIT_DELAY);
|
mdelay(QLC_83XX_DRV_LOCK_WAIT_DELAY);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user