https://git.reactos.org/?p=reactos.git;a=commitdiff;h=19cdb521d2ffc4b9bcdba…
commit 19cdb521d2ffc4b9bcdbad81adc78e615b648263
Author:     George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Thu Sep 23 18:11:02 2021 +0200
Commit:     George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Fri Sep 24 19:49:40 2021 +0200
    [NTOS:OB] Acquire the lock before setting directory's session ID
---
 ntoskrnl/ob/oblife.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/ob/oblife.c b/ntoskrnl/ob/oblife.c
index d649b0f0492..5fc68b0d6b5 100644
--- a/ntoskrnl/ob/oblife.c
+++ b/ntoskrnl/ob/oblife.c
@@ -1849,9 +1849,17 @@ NtSetInformationObject(IN HANDLE ObjectHandle,
                                                    NULL);
                 if (NT_SUCCESS(Status))
                 {
-                    /* FIXME: Missng locks */
+                    /* Setup a lookup context */
+                    OBP_LOOKUP_CONTEXT LookupContext;
+                    ObpInitializeLookupContext(&LookupContext);
+
                     /* Set its session ID */
+                    ObpAcquireDirectoryLockExclusive(Directory, &LookupContext);
                     Directory->SessionId = PsGetCurrentProcessSessionId();
+                    ObpReleaseDirectoryLock(Directory, &LookupContext);
+
+                    /* We're done, release the context and dereference the directory
*/
+                    ObpReleaseLookupContext(&LookupContext);
                     ObDereferenceObject(Directory);
                 }
             }