[PATCH qxl-wddm-dod v2 25/25] Fixing possible BSOD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Interrupts seem to arrive to the driver before the initialization phase
is over (m_pHWDevice = NULL), in that case we can't handle interrupts yet. Even
when m_pHWDevice isn't NULL, other fields aren't necessarly fully intialized till
the StartDevice function has finished initialization, thus the flag
DriverStarted should be checked upon interrupts.

Note: There is no way provided by microsoft to disable interrupts in WDDM
drivers.

Signed-off-by: Sameeh Jubran <sameeh@xxxxxxxxxx>
---
 qxldod/QxlDod.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 44989c7..48bf1f6 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -58,6 +58,7 @@ QxlDod::QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject) : m_pPhysicalDevice(pP
     PAGED_CODE();
     DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s\n", __FUNCTION__));
     *((UINT*)&m_Flags) = 0;
+    m_Flags.DriverStarted = FALSE;
     RtlZeroMemory(&m_DxgkInterface, sizeof(m_DxgkInterface));
     RtlZeroMemory(&m_DeviceInfo, sizeof(m_DeviceInfo));
     RtlZeroMemory(m_CurrentModes, sizeof(m_CurrentModes));
@@ -129,7 +130,6 @@ NTSTATUS QxlDod::StartDevice(_In_  DXGK_START_INFO*   pDxgkStartInfo,
     RtlZeroMemory(m_CurrentModes, sizeof(m_CurrentModes));
     //CHECK ME!!!!!!!!!!!!!
     m_CurrentModes[0].DispInfo.TargetId = D3DDDI_ID_UNINITIALIZED;
-    m_Flags.DriverStarted = TRUE;
     do {
 
         // Get device information from OS.
@@ -180,7 +180,6 @@ NTSTATUS QxlDod::StartDevice(_In_  DXGK_START_INFO*   pDxgkStartInfo,
         }
     } while (0);
     if (!NT_SUCCESS(Status)) {
-        m_Flags.DriverStarted = FALSE;
         return Status;
     }
 
@@ -196,6 +195,7 @@ NTSTATUS QxlDod::StartDevice(_In_  DXGK_START_INFO*   pDxgkStartInfo,
     }
     *pNumberOfViews = MAX_VIEWS;
     *pNumberOfChildren = MAX_CHILDREN;
+    m_Flags.DriverStarted = TRUE;
     DbgPrint(TRACE_LEVEL_INFORMATION, ("<--- %s\n", __FUNCTION__));
     return STATUS_SUCCESS;
 }
@@ -1675,7 +1675,10 @@ VOID QxlDod::DpcRoutine(VOID)
 BOOLEAN QxlDod::InterruptRoutine(_In_  ULONG MessageNumber)
 {
     DbgPrint(TRACE_LEVEL_INFORMATION, ("<--> 0 %s\n", __FUNCTION__));
-    return m_pHWDevice->InterruptRoutine(&m_DxgkInterface, MessageNumber);
+    if (m_Flags.DriverStarted) {
+        return m_pHWDevice ? m_pHWDevice->InterruptRoutine(&m_DxgkInterface, MessageNumber) : FALSE;
+    }
+    return FALSE;
 }
 
 VOID QxlDod::ResetDevice(VOID)
-- 
2.7.0.windows.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]