Author: tfaber
Date: Wed May 25 10:27:17 2016
New Revision: 71398
URL:
http://svn.reactos.org/svn/reactos?rev=71398&view=rev
Log:
[NTOS:EX]
- Use the calling thread instead of the passed-in thread to validate APC status in
ExReleaseResourceForThreadLite. The latter can be user-set and might not be a KTHREAD at
all.
CORE-11315 #resolve
Modified:
trunk/reactos/ntoskrnl/ex/resource.c
trunk/rostests/kmtests/ntos_ex/ExResource.c
Modified: trunk/reactos/ntoskrnl/ex/resource.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/resource.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/resource.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/resource.c [iso-8859-1] Wed May 25 10:27:17 2016
@@ -1817,7 +1817,7 @@
ExReleaseResourceLite(IN PERESOURCE Resource)
{
/* Just call the For-Thread function */
- ExReleaseResourceForThreadLite(Resource, (ERESOURCE_THREAD)PsGetCurrentThread());
+ ExReleaseResourceForThreadLite(Resource, ExGetCurrentResourceThread());
}
/*++
@@ -1855,7 +1855,7 @@
/* Sanity checks */
ExpVerifyResource(Resource);
- ExpCheckForApcsDisabled(LockHandle.OldIrql, Resource, (PKTHREAD)Thread);
+ ExpCheckForApcsDisabled(LockHandle.OldIrql, Resource, KeGetCurrentThread());
/* Check if it's exclusively owned */
if (IsOwnedExclusive(Resource))
Modified: trunk/rostests/kmtests/ntos_ex/ExResource.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_ex/ExResourc…
==============================================================================
--- trunk/rostests/kmtests/ntos_ex/ExResource.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_ex/ExResource.c [iso-8859-1] Wed May 25 10:27:17 2016
@@ -505,6 +505,10 @@
KeEnterCriticalRegion();
ok_bool_true(ExAcquireResourceExclusiveLite(Res, FALSE),
"ExAcquireResourceExclusiveLite returned");
+ ExSetResourceOwnerPointer(Res, (PVOID)(ULONG_PTR)3);
+ ExReleaseResourceForThreadLite(Res, 3);
+
+ ok_bool_true(ExAcquireResourceExclusiveLite(Res, FALSE),
"ExAcquireResourceExclusiveLite returned");
ExSetResourceOwnerPointer(Res, (PVOID)((ULONG_PTR)Res | 3));
KeLeaveCriticalRegion();