Skip to content

Commit

Permalink
qlcnic: Fix a sleep-in-atomic bug in qlcnic_82xx_hw_write_wx_2M and q…
Browse files Browse the repository at this point in the history
…lcnic_82xx_hw_read_wx_2M

[ Upstream commit 5ea6d69 ]

The driver may sleep under a write spin lock, and the function
call path is:
qlcnic_82xx_hw_write_wx_2M (acquire the lock by write_lock_irqsave)
  crb_win_lock
    qlcnic_pcie_sem_lock
      usleep_range
qlcnic_82xx_hw_read_wx_2M (acquire the lock by write_lock_irqsave)
  crb_win_lock
    qlcnic_pcie_sem_lock
      usleep_range

To fix it, the usleep_range is replaced with udelay.

Signed-off-by: Jia-Ju Bai <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
XidianGeneral authored and gregkh committed Apr 13, 2018
1 parent 2761eda commit d78b198
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg)
}
return -EIO;
}
usleep_range(1000, 1500);
udelay(1200);
}

if (id_reg)
Expand Down

0 comments on commit d78b198

Please sign in to comment.