From 19cdb521d2ffc4b9bcdbad81adc78e615b648263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Bi=C8=99oc?= Date: Thu, 23 Sep 2021 18:11:02 +0200 Subject: [PATCH] [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); } }