diff options
author | Linus Groh <mail@linusgroh.de> | 2022-01-26 19:22:28 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-26 21:34:26 +0000 |
commit | d8fb3290d5dc4fb60b182666a530629666edf1fa (patch) | |
tree | 7dfff0ece96d0b7058fc09fa6f4e6442692f7d23 /Kernel/Storage | |
parent | 371d49c0f6d9927ac1a1729a63714a66eb4ea51e (diff) | |
download | serenity-d8fb3290d5dc4fb60b182666a530629666edf1fa.zip |
Kernel/Storage: Add device null check in AHCIPort::handle_interrupt()
Before attempting to remove the device while handling an AHCI port
interrupt, check if m_connected_device is even non-null.
This happened during my bare metal run and caused a kernel panic.
Diffstat (limited to 'Kernel/Storage')
-rw-r--r-- | Kernel/Storage/ATA/AHCIPort.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Storage/ATA/AHCIPort.cpp b/Kernel/Storage/ATA/AHCIPort.cpp index a950b5b819..381a260527 100644 --- a/Kernel/Storage/ATA/AHCIPort.cpp +++ b/Kernel/Storage/ATA/AHCIPort.cpp @@ -73,7 +73,7 @@ void AHCIPort::handle_interrupt() } if (m_interrupt_status.is_set(AHCI::PortInterruptFlag::PRC) && m_interrupt_status.is_set(AHCI::PortInterruptFlag::PC)) { clear_sata_error_register(); - if ((m_port_registers.ssts & 0xf) != 3) { + if ((m_port_registers.ssts & 0xf) != 3 && m_connected_device) { m_connected_device->prepare_for_unplug(); StorageManagement::the().remove_device(*m_connected_device); g_io_work->queue([this]() { |