From 6440beeffe9e6d06002a75ef91419d7c8b7ccf8f Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 19 Mar 2021 21:05:47 +0200 Subject: [PATCH] Kernel/AHCI: Shift the call to reset() for the WorkQueue --- Kernel/Storage/AHCIPort.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Kernel/Storage/AHCIPort.cpp b/Kernel/Storage/AHCIPort.cpp index d0e01bfe16..81104e2a2e 100644 --- a/Kernel/Storage/AHCIPort.cpp +++ b/Kernel/Storage/AHCIPort.cpp @@ -102,7 +102,11 @@ void AHCIPort::handle_interrupt() m_wait_connect_for_completion = true; } if (m_interrupt_status.is_set(AHCI::PortInterruptFlag::INF)) { - reset(); + // We need to defer the reset, because we can receive interrupts when + // resetting the device. + g_io_work->queue([this]() { + reset(); + }); return; } if (m_interrupt_status.is_set(AHCI::PortInterruptFlag::IF) || m_interrupt_status.is_set(AHCI::PortInterruptFlag::TFE) || m_interrupt_status.is_set(AHCI::PortInterruptFlag::HBD) || m_interrupt_status.is_set(AHCI::PortInterruptFlag::HBF)) {