From 7fd6f86803b8ab30790cedc0921e31a8c294140f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Bi=C8=99oc?= Date: Fri, 3 Mar 2023 21:21:05 +0100 Subject: [PATCH] [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);