Skip to content

Commit f6fe0b2

Browse files
maurizio-lombardikeithbusch
authored andcommitted
nvme-pci: fix sleeping function called from interrupt context
the nvme_handle_cqe() interrupt handler calls nvme_complete_async_event() but the latter may call nvme_auth_stop() which is a blocking function. Sleeping functions can't be called in interrupt context BUG: sleeping function called from invalid context in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/15 Call Trace: <IRQ> __cancel_work_timer+0x31e/0x460 ? nvme_change_ctrl_state+0xcf/0x3c0 [nvme_core] ? nvme_change_ctrl_state+0xcf/0x3c0 [nvme_core] nvme_complete_async_event+0x365/0x480 [nvme_core] nvme_poll_cq+0x262/0xe50 [nvme] Fix the bug by moving nvme_auth_stop() to fw_act_work (executed by the nvme_wq workqueue) Fixes: f50fff7 ("nvme: implement In-Band authentication") Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Reviewed-by: Jens Axboe <axboe@kernel.dk> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent d3e8b18 commit f6fe0b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4137,6 +4137,8 @@ static void nvme_fw_act_work(struct work_struct *work)
41374137
struct nvme_ctrl, fw_act_work);
41384138
unsigned long fw_act_timeout;
41394139

4140+
nvme_auth_stop(ctrl);
4141+
41404142
if (ctrl->mtfa)
41414143
fw_act_timeout = jiffies +
41424144
msecs_to_jiffies(ctrl->mtfa * 100);
@@ -4192,7 +4194,6 @@ static bool nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
41924194
* firmware activation.
41934195
*/
41944196
if (nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) {
4195-
nvme_auth_stop(ctrl);
41964197
requeue = false;
41974198
queue_work(nvme_wq, &ctrl->fw_act_work);
41984199
}

0 commit comments

Comments
 (0)