Author: cgutman
Date: Tue Nov 15 22:16:57 2011
New Revision: 54389
URL:
http://svn.reactos.org/svn/reactos?rev=54389&view=rev
Log:
[NTOSKRNL]
- Fix 2 broken failure cases (forgot to detach from process and/or forgot to dereference
process)
Modified:
trunk/reactos/ntoskrnl/mm/anonmem.c
Modified: trunk/reactos/ntoskrnl/mm/anonmem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/anonmem.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/anonmem.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/anonmem.c [iso-8859-1] Tue Nov 15 22:16:57 2011
@@ -683,6 +683,7 @@
{
/* Fail without it */
DPRINT1("Privilege not held for MEM_LARGE_PAGES\n");
+ if (Attached) KeUnstackDetachProcess(&ApcState);
if (ProcessHandle != NtCurrentProcess()) ObDereferenceObject(Process);
return STATUS_PRIVILEGE_NOT_HELD;
}
@@ -701,6 +702,8 @@
(Protect & (PAGE_WRITECOPY | PAGE_EXECUTE_WRITECOPY)))
{
DPRINT1("Copy on write is not supported by VirtualAlloc\n");
+ if (Attached) KeUnstackDetachProcess(&ApcState);
+ if (ProcessHandle != NtCurrentProcess()) ObDereferenceObject(Process);
return STATUS_INVALID_PAGE_PROTECTION;
}