https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7fd6f86803b8ab30790cedc0921e31a8c294140f

commit 7fd6f86803b8ab30790cedc0921e31a8c294140f
Author:     George Bișoc <george.bi...@reactos.org>
AuthorDate: Fri Mar 3 21:21:05 2023 +0100
Commit:     George Bișoc <george.bi...@reactos.org>
CommitDate: Sun Oct 1 20:06:02 2023 +0200

    [NTOS:CM] Do not acquire a KCB lock twice when deleting a key object
    
    This prevents a deadlock in DelistKeyBodyFromKCB when we delete a key
    object because of an access check failure during a open procedure of a
    registry key, as we are already holding a lock against the target KCB of
    the key body.
---
 ntoskrnl/config/cmsysini.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ntoskrnl/config/cmsysini.c b/ntoskrnl/config/cmsysini.c
index df6ebbd90d4..32450c366a6 100644
--- a/ntoskrnl/config/cmsysini.c
+++ b/ntoskrnl/config/cmsysini.c
@@ -138,7 +138,7 @@ CmpDeleteKeyObject(PVOID DeletedObject)
         if (Kcb)
         {
             /* Delist the key */
-            DelistKeyBodyFromKCB(KeyBody, FALSE);
+            DelistKeyBodyFromKCB(KeyBody, KeyBody->KcbLocked);
 
             /* Dereference the KCB */
             CmpDelayDerefKeyControlBlock(Kcb);

Reply via email to