Hi
We have a WFP driver based on inspect WDK sample.
As in stack we can see mydriver!WFPCloneReinjectInbound+0x18c I am making an call to FwpsInjectTransportReceiveAsync0 function.
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: 0000000000000007, Attempt to free pool which was already freed
Arg2: 0000000000001200, (reserved)
Arg3: 0000000000000000, Memory contents of the pool block
Arg4: ffffe00005c8e168, Address of the block of pool being deallocated
Debugging Details:
POOL_ADDRESS: ffffe00005c8e168
FREED_POOL_TAG: NDnd
BUGCHECK_STR: 0xc2_7_NDnd
DEFAULT_BUCKET_ID: WIN8_DRIVER_FAULT
PROCESS_NAME: System
CURRENT_IRQL: 2
ANALYSIS_VERSION: 6.3.9600.17029 (debuggers(dbg).140219-1702) amd64fre
LAST_CONTROL_TRANSFER: from fffff8001d714f5c to fffff8001d5c38a0
STACK_TEXT:
ffffd000218881c8 fffff800
1d714f5c : 00000000000000c2 00000000
00000007 0000000000001200 00000000
00000000 : nt!KeBugCheckEx
ffffd000218881d0 fffff800
52303653 : 0000000000000000 ffffe000
049b0500 ffffe000049a1390 00000000
00000000 : nt!ExDeferredFreePool+0x6ec
ffffd000218882c0 fffff800
53383455 : 0000000000000000 fffff800
534fa6fd 0000000000000000 00000000
00000000 : NETIO!NetioFreeMdl+0x232d3
ffffd00021888310 fffff800
522d9142 : ffffe000031e3500 00000000
00000001 0000000000000000 00000000
00000000 : tcpip!FlpReturnNetBufferListChain+0x8b585
ffffd00021888360 fffff800
522d53a2 : 0000000000000000 ffffe000
049b05f0 0000000000000000 ffffe000
050ee140 : NETIO!NetioDereferenceNetBufferList+0xb2
ffffd000218883a0 fffff800
532fad53 : 0000000000000000 ffffd000
21888400 0000000000000000 00000000
00000000 : NETIO!NetioDereferenceNetBufferListChain+0x2e2
ffffd00021888440 fffff800
532f9040 : fffff8005344b180 ffffe000
050ee140 ffffe000024e0000 ffffe000
024e0000 : tcpip!IppReceiveHeaderBatch+0x323
ffffd00021888560 fffff800
533edd30 : ffffe00003488bd0 00000000
00000000 0000000000000001 00000000
00000000 : tcpip!IppFlcReceivePacketsCore+0x680
ffffd000218888e0 fffff800
534fa2fd : ffffe00004ae2902 ffffe000
02375c10 ffffd00021888bb9 ffffd000
21883000 : tcpip!IppInspectInjectReceive+0x148
ffffd00021888940 fffff800
1d52ef63 : 0000000000000000 00000000
00000000 0000000000000000 fffff800
534fa7c0 : fwpkclnt!FwppInjectionStackCallout+0xe5
ffffd000218889d0 fffff800
5350b7ae : fffff800534fa218 ffffd000
21888b40 0000000000000010 ffffe000
03b32c70 : nt!KeExpandKernelStackAndCalloutInternal+0xf3
ffffd00021888ac0 fffff800
52d0231c : ffffe00003b32c70 00000000
00000000 ffffe000049b0700 ffffe000
02e42650 : fwpkclnt!FwpsInjectTransportReceiveAsync0+0x2ea
ffffd00021888c00 fffff800
52d026ed : ffffe000050ee140 ffffe000
02e42650 fffff80052d06e10 00000000
00000000 : mydriver!WFPCloneReinjectInbound+0x18c
ffffd00021888c80 fffff800
1d571554 : ffffe00003b33880 ffffe000
02e42650 0000000000000080 00000000
00000001 : mydriver!WFP_AuthenticateThread+0x315
ffffd00021888d40 fffff800
1d5c9ec6 : ffffd000205ce180 ffffe000
03b33880 ffffd000205da240 00000000
00005000 : nt!PspSystemThreadStartup+0x58
ffffd00021888da0 00000000
00000000 : ffffd00021889000 ffffd000
21883000 0000000000000000 00000000
00000000 : nt!KiStartSystemThread+0x16
There are some observations which may help:
-> Happens sometimes when we pend packet at ALE AUTH RECIEVE ( INBOUND ) and then process packets in separate thread and then while reinjecting it deferences the NET_BUFFER_LIST.
Since this happens only sometimes,so when we try to deference BSOD happens.
-> The machine has NSClient++ installed.It is observed that when nscp.exe connects at port 5666 then at server process it is INBOUND at 5666 port and while reinjecting the packet it dereferences.After uninstalling NSClient++ this problem also happened though very infrequently.
-> I want to know under what conditions does derefernce happens so that I can skip dereference myself later for that particular case.
-> Searching through google I could find many such cases where WFP driver crashes similarly but everywhere the solution is just to uninstall the particular driver.