[Spice-devel] [PATCH v3 28/28] Fixing possible BSOD

Sameeh Jubran sameeh at daynix.com
Wed Sep 7 13:10:46 UTC 2016


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 at daynix.com>
---
 qxldod/QxlDod.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index ffe29a7..3d684e7 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -64,6 +64,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));
@@ -1680,7 +1681,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



More information about the Spice-devel mailing list