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 <sameeh@daynix.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Sameeh Jubran 2016-09-26 16:00:11 +03:00 committed by Frediano Ziglio
parent f6e099db39
commit f87019cb01

View File

@ -63,6 +63,7 @@ QxlDod::QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject) : m_pPhysicalDevice(pP
{ {
DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s\n", __FUNCTION__));
*((UINT*)&m_Flags) = 0; *((UINT*)&m_Flags) = 0;
m_Flags.DriverStarted = FALSE;
RtlZeroMemory(&m_DxgkInterface, sizeof(m_DxgkInterface)); RtlZeroMemory(&m_DxgkInterface, sizeof(m_DxgkInterface));
RtlZeroMemory(&m_DeviceInfo, sizeof(m_DeviceInfo)); RtlZeroMemory(&m_DeviceInfo, sizeof(m_DeviceInfo));
RtlZeroMemory(m_CurrentModes, sizeof(m_CurrentModes)); RtlZeroMemory(m_CurrentModes, sizeof(m_CurrentModes));
@ -1677,7 +1678,10 @@ VOID QxlDod::DpcRoutine(VOID)
BOOLEAN QxlDod::InterruptRoutine(_In_ ULONG MessageNumber) BOOLEAN QxlDod::InterruptRoutine(_In_ ULONG MessageNumber)
{ {
DbgPrint(TRACE_LEVEL_INFORMATION, ("<--> 0 %s\n", __FUNCTION__)); 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) VOID QxlDod::ResetDevice(VOID)