From: Thomas Faber Date: Thu, 18 May 2017 21:29:24 +0000 (+0000) Subject: [VIDEOPRT] X-Git-Tag: ReactOS-0.4.6~685 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=17c95d527981b93817752040b8d34f17e1296383;ds=sidebyside [VIDEOPRT] - Guard Ke386CallBios calls against concurrent execution. CORE-13214 svn path=/trunk/; revision=74581 --- diff --git a/reactos/win32ss/drivers/videoprt/int10.c b/reactos/win32ss/drivers/videoprt/int10.c index 14ed49231e7..0893db7ace1 100644 --- a/reactos/win32ss/drivers/videoprt/int10.c +++ b/reactos/win32ss/drivers/videoprt/int10.c @@ -296,7 +296,9 @@ IntInt10CallBios( 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 @@ VideoPortInt10( 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; diff --git a/reactos/win32ss/drivers/videoprt/videoprt.c b/reactos/win32ss/drivers/videoprt/videoprt.c index 2c0cbee7e7a..9bfb2a24b0c 100644 --- a/reactos/win32ss/drivers/videoprt/videoprt.c +++ b/reactos/win32ss/drivers/videoprt/videoprt.c @@ -33,6 +33,7 @@ ULONG CsrssInitialized = FALSE; PKPROCESS Csrss = NULL; ULONG VideoPortDeviceNumber = 0; +KMUTEX VideoPortInt10Mutex; /* PRIVATE FUNCTIONS **********************************************************/ @@ -464,9 +465,16 @@ VideoPortInitialize( 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)) { diff --git a/reactos/win32ss/drivers/videoprt/videoprt.h b/reactos/win32ss/drivers/videoprt/videoprt.h index eb0e4cb5694..3490e5625ba 100644 --- a/reactos/win32ss/drivers/videoprt/videoprt.h +++ b/reactos/win32ss/drivers/videoprt/videoprt.h @@ -247,6 +247,7 @@ IntVideoPortMapPhysicalMemory( extern ULONG CsrssInitialized; extern PKPROCESS Csrss; extern ULONG VideoPortDeviceNumber; +extern KMUTEX VideoPortInt10Mutex; VOID FASTCALL IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);