Procházet zdrojové kódy

Kernel: Fix lock state corruption in AHCIPORT::start_request

This code was unlocking the lock directly, but the Locker is still
attached, causing the lock to be unlocked an extra time, hence
corrupting the internal lock state.

This is extra confusing though, as complete_current_request() runs
without a lock which also looks like a bug. But that's a task for
another day.
Brian Gianforcaro před 4 roky
rodič
revize
f3f5a225b9
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      Kernel/Storage/AHCIPort.cpp

+ 2 - 2
Kernel/Storage/AHCIPort.cpp

@@ -454,7 +454,7 @@ void AHCIPort::start_request(AsyncBlockDeviceRequest& request)
     auto result = prepare_and_set_scatter_list(request);
     if (result.has_value()) {
         dbgln_if(AHCI_DEBUG, "AHCI Port {}: Request failure.", representative_port_index());
-        m_lock.unlock();
+        locker.unlock();
         complete_current_request(result.value());
         return;
     }
@@ -462,7 +462,7 @@ void AHCIPort::start_request(AsyncBlockDeviceRequest& request)
     auto success = access_device(request.request_type(), request.block_index(), request.block_count());
     if (!success) {
         dbgln_if(AHCI_DEBUG, "AHCI Port {}: Request failure.", representative_port_index());
-        m_lock.unlock();
+        locker.unlock();
         complete_current_request(AsyncDeviceRequest::Failure);
         return;
     }