From 4fb2fdbac6e45f3c8ed5eff0f10dd368a988abe9 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 30 Apr 2024 15:12:57 +0300 Subject: [PATCH] [NTOS:CM] Properly unlock registry on failure in NtUnloadKey2 --- ntoskrnl/config/ntapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntoskrnl/config/ntapi.c b/ntoskrnl/config/ntapi.c index 6748326a2c8..f425b3a79e0 100644 --- a/ntoskrnl/config/ntapi.c +++ b/ntoskrnl/config/ntapi.c @@ -1953,6 +1953,7 @@ NtUnloadKey2(IN POBJECT_ATTRIBUTES TargetKey, _SEH2_END; } +Quit: /* If CmUnloadKey() failed we need to unlock registry ourselves */ if (!NT_SUCCESS(Status)) { @@ -1969,7 +1970,6 @@ NtUnloadKey2(IN POBJECT_ATTRIBUTES TargetKey, CmpUnlockRegistry(); } -Quit: /* Dereference the key */ ObDereferenceObject(KeyBody);