From f87019cb016a5bb8bdcdaddde57a4a18e0bff195 Mon Sep 17 00:00:00 2001 From: Sameeh Jubran Date: Mon, 26 Sep 2016 16:00:11 +0300 Subject: [PATCH] Fixing possible BSOD 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 necessarily fully initialized 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 Acked-by: Frediano Ziglio --- qxldod/QxlDod.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp index accf895..5dada4f 100755 --- a/qxldod/QxlDod.cpp +++ b/qxldod/QxlDod.cpp @@ -63,6 +63,7 @@ QxlDod::QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject) : m_pPhysicalDevice(pP { 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)); @@ -1677,7 +1678,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 && m_pHWDevice) { + return m_pHWDevice->InterruptRoutine(&m_DxgkInterface, MessageNumber); + } + return FALSE; } VOID QxlDod::ResetDevice(VOID)