Skip to content

Commit 8eff6df

Browse files
committed
[NTOS] Don't dereference the object when ObInsertObject fails
See CORE-17904
1 parent 72b98da commit 8eff6df

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ntoskrnl/mm/section.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,7 @@ MmCreatePhysicalMemorySection(VOID)
23122312
&Handle);
23132313
if (!NT_SUCCESS(Status))
23142314
{
2315-
ObDereferenceObject(PhysSection);
2315+
/* Note: ObInsertObject dereferences PhysSection on failure */
23162316
return Status;
23172317
}
23182318
ObCloseHandle(Handle, KernelMode);

ntoskrnl/se/tokenlif.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ SepCreateToken(
417417
if (!NT_SUCCESS(Status))
418418
{
419419
DPRINT1("ObInsertObject() failed (Status 0x%lx)\n", Status);
420+
/* Note: ObInsertObject dereferences AccessToken on failure */
421+
return Status;
420422
}
421423
}
422424
else
@@ -2243,6 +2245,7 @@ NtFilterToken(
22432245
if (!NT_SUCCESS(Status))
22442246
{
22452247
DPRINT1("NtFilterToken(): Failed to insert the filtered token (Status 0x%lx)\n", Status);
2248+
/* Note: ObInsertObject dereferences FilteredToken on failure */
22462249
goto Quit;
22472250
}
22482251

0 commit comments

Comments
 (0)