[NTOSKRNL]
authorRafal Harabien <rafalh@reactos.org>
Wed, 1 Jun 2011 18:16:52 +0000 (18:16 +0000)
committerRafal Harabien <rafalh@reactos.org>
Wed, 1 Jun 2011 18:16:52 +0000 (18:16 +0000)
- Bugcheck if ExFreePoolWithTag is called with wrong tag

svn path=/trunk/; revision=52044

reactos/ntoskrnl/mm/ARM3/expool.c

index eb5bc01..9206e56 100644 (file)
@@ -736,7 +736,7 @@ ExAllocatePool(POOL_TYPE PoolType,
     //
     // Use a default tag of "None"
     //
-    return ExAllocatePoolWithTag(PoolType, NumberOfBytes, 'enoN');
+    return ExAllocatePoolWithTag(PoolType, NumberOfBytes, TAG_NONE);
 }
 
 /*
@@ -788,6 +788,15 @@ ExFreePoolWithTag(IN PVOID P,
     //
     OldIrql = ExLockPool(PoolDesc);
 
+    //
+    // Check block tag
+    //
+    if (TagToFree && TagToFree != Entry->PoolTag)
+    {
+       DPRINT1("Freeing pool - invalid tag specified: %.4s != %.4s\n", (char*)&TagToFree, (char*)&Entry->PoolTag);
+       KeBugCheckEx(BAD_POOL_CALLER, 0x0A, (ULONG_PTR)P, Entry->PoolTag, TagToFree);
+    }
+
     //
     // Check if the next allocation is at the end of the page
     //