From 796aa0f7b357e8cf18f53fcf1d652d90c269a790 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 10 Sep 2016 13:54:16 +0000 Subject: [PATCH] [NTOSKRNL] Fix lock/unlock order in SeLockSubjectContext/SeUnlockSubjectContext. Patch by Volodymyr Shcherbyna. CORE-11966 #resolve #comment Thanks a lot! svn path=/trunk/; revision=72644 --- reactos/ntoskrnl/se/access.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/se/access.c b/reactos/ntoskrnl/se/access.c index 05eee94990b..cc87da8160c 100644 --- a/reactos/ntoskrnl/se/access.c +++ b/reactos/ntoskrnl/se/access.c @@ -338,12 +338,14 @@ SeUnlockSubjectContext(IN PSECURITY_SUBJECT_CONTEXT SubjectContext) PrimaryToken = SubjectContext->PrimaryToken; ClientToken = SubjectContext->ClientToken; + /* Unlock the impersonation one if it's there */ + if (ClientToken) + { + SepReleaseTokenLock(ClientToken); + } + /* Always unlock the primary one */ SepReleaseTokenLock(PrimaryToken); - - /* Unlock the impersonation one if it's there */ - if (!ClientToken) return; - SepReleaseTokenLock(ClientToken); } /*