Author: tfaber Date: Thu May 18 21:29:24 2017 New Revision: 74581
URL: http://svn.reactos.org/svn/reactos?rev=74581&view=rev Log: [VIDEOPRT] - Guard Ke386CallBios calls against concurrent execution. CORE-13214
Modified: trunk/reactos/win32ss/drivers/videoprt/int10.c trunk/reactos/win32ss/drivers/videoprt/videoprt.c trunk/reactos/win32ss/drivers/videoprt/videoprt.h
Modified: trunk/reactos/win32ss/drivers/videoprt/int10.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/drivers/videoprt/in... ============================================================================== --- trunk/reactos/win32ss/drivers/videoprt/int10.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/drivers/videoprt/int10.c [iso-8859-1] Thu May 18 21:29:24 2017 @@ -296,7 +296,9 @@ BiosContext.SegEs = BiosArguments->SegEs;
/* Do the ROM BIOS call */ + (void)KeWaitForMutexObject(&VideoPortInt10Mutex, Executive, KernelMode, FALSE, NULL); Status = Ke386CallBios(0x10, &BiosContext); + KeReleaseMutex(&VideoPortInt10Mutex, FALSE);
/* Return the arguments */ BiosArguments->Eax = BiosContext.Eax; @@ -354,7 +356,9 @@ BiosContext.Ebp = BiosArguments->Ebp;
/* Do the ROM BIOS call */ + (void)KeWaitForMutexObject(&VideoPortInt10Mutex, Executive, KernelMode, FALSE, NULL); Status = Ke386CallBios(0x10, &BiosContext); + KeReleaseMutex(&VideoPortInt10Mutex, FALSE);
/* Return the arguments */ BiosArguments->Eax = BiosContext.Eax;
Modified: trunk/reactos/win32ss/drivers/videoprt/videoprt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/drivers/videoprt/vi... ============================================================================== --- trunk/reactos/win32ss/drivers/videoprt/videoprt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/drivers/videoprt/videoprt.c [iso-8859-1] Thu May 18 21:29:24 2017 @@ -33,6 +33,7 @@ ULONG CsrssInitialized = FALSE; PKPROCESS Csrss = NULL; ULONG VideoPortDeviceNumber = 0; +KMUTEX VideoPortInt10Mutex;
/* PRIVATE FUNCTIONS **********************************************************/
@@ -464,8 +465,15 @@ NTSTATUS Status; PVIDEO_PORT_DRIVER_EXTENSION DriverExtension; BOOLEAN PnpDriver = FALSE, LegacyDetection = FALSE; + static BOOLEAN Int10MutexInitialized;
TRACE_(VIDEOPRT, "VideoPortInitialize\n"); + + if (!Int10MutexInitialized) + { + KeInitializeMutex(&VideoPortInt10Mutex, 0); + Int10MutexInitialized = TRUE; + }
/* As a first thing do parameter checks. */ if (HwInitializationData->HwInitDataSize > sizeof(VIDEO_HW_INITIALIZATION_DATA))
Modified: trunk/reactos/win32ss/drivers/videoprt/videoprt.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/drivers/videoprt/vi... ============================================================================== --- trunk/reactos/win32ss/drivers/videoprt/videoprt.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/drivers/videoprt/videoprt.h [iso-8859-1] Thu May 18 21:29:24 2017 @@ -247,6 +247,7 @@ extern ULONG CsrssInitialized; extern PKPROCESS Csrss; extern ULONG VideoPortDeviceNumber; +extern KMUTEX VideoPortInt10Mutex;
VOID FASTCALL IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);