why does IoMakeAssociatedIrp call ExFreePoolWithTag

I got a strange BSOD, it apears that IoMakeAssociatedIrp calls
ExFreePoolWithTag and frees something that already was freed:

Windows 7 Kernel Version 7600 MP (2 procs) Free x86 compatible
Product: WinNt, suite: TerminalServer SingleUserTS
Built by: 7600.16385.x86fre.win7_rtm.090713-1255

1: kd> !analyze -v
*******************************************************************************
*
*
* Bugcheck Analysis
*
*
*
*******************************************************************************

BAD_POOL_CALLER (c2)
The current thread is making a bad pool request. Typically this is at a
bad IRQL level or double freeing the same allocation, etc.
Arguments:
Arg1: 00000007, Attempt to free pool which was already freed
Arg2: 00001097, (reserved)
Arg3: 00000000, Memory contents of the pool block
Arg4: 85fb9870, Address of the block of pool being deallocated

STACK_TEXT:
92d4535c 8286ae7f 85fb9870 00000000 85fb7d00 nt!ExFreePoolWithTag+0x1b1
92d4538c 8d17b80d 85fb9690 000001d8 85f75198 nt!IoMakeAssociatedIrp+0xd7
92d453e4 8d1797be 85f75198 85f758d0 92d4540c
Ext2Fsd!Ext2ReadWriteBlocks+0xf3
[c:\works\ext2fsd\0.48\src\ext3fsd\block.c @ 292]
92d45470 8d17a093 85f75198 00000000 85f75198 Ext2Fsd!Ext2ReadVolume+0x23a
[c:\works\ext2fsd\0.48\src\ext3fsd\read.c @ 251]
92d454b8 8d17df57 85f75198 85fb9690 8d17e0b3 Ext2Fsd!Ext2Read+0x8b
[c:\works\ext2fsd\0.48\src\ext3fsd\read.c @ 896]
92d454c4 8d17e0b3 85f75198 20048000 85f75818
Ext2Fsd!Ext2DispatchRequest+0x45
[c:\works\ext2fsd\0.48\src\ext3fsd\dispatch.c @ 233]
92d45500 828754bc 85f75818 85fb9690 85fb9690 Ext2Fsd!Ext2BuildRequest+0x8b
[c:\works\ext2fsd\0.48\src\ext3fsd\dispatch.c @ 330]
92d45518 828de000 8677b8e9 8677b870 85f75c72 nt!IofCallDriver+0x63
92d45534 82a4a07c 85f75c70 864599c8 8677b8a8 nt!IoPageRead+0x1f5
92d45568 82a4b630 85f72810 00000001 9ba48000 nt!MiPfExecuteReadList+0x10c
92d45594 828ef844 20048000 00000008 00001000
nt!MmPrefetchForCacheManager+0xa4
92d455d4 82a96d20 85f75c70 00000001 92d4564c nt!CcFetchDataForRead+0x94
92d45614 82a98987 85f75c70 20048000 00000008 nt!CcMapAndCopyFromCache+0x71
92d45650 8d0eacee 85f75c70 92d45684 00001000 nt!CcCopyRead+0x107

It calls ExFreePool for some internal book-keeping work, to do with handling of the pre-allocated IRP pool.

This is likely to be caused by either a pool scribble or accessing an IRP after you had returned/completed it.

Peter
OSR

On Sat, 31 Oct 2009, xxxxx@osr.com wrote:

This is likely to be caused by either a pool scribble or accessing an IRP after you had returned/completed it.

Yes I have found and fixed one bug like that so probably this BSOD was
related to the memory corruption, thanks for your answer.

Bo Branten