I am trying to figure out why I get this:
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.
I have two queues. One default queue that is configured with WdfIoQueueDispatchParallel
. Lets call this queue 1. This queue completes one of the IOCTL messages (message A), and forwards messages B to a second queue, which is configured with WdfIoQueueDispatchSequential
. Lets call this queue 2.
Is it correct that with this setup I could get multiple A and B messages delivered to queue 1, but only one B message at a time delivered from queue 2?
When the above bug check occured I can see that the different stack traces for the different processors points to that the above is not correct.
nt!DbgBreakPointWithStatus
nt!KiBugCheckDebugBreak+0x12
nt!KeBugCheck2+0x946
nt!KeBugCheckEx+0x107
nt!ExFreeHeapPool+0x20b232
nt!ExFreePool+0x9
USBDriver!doThings+0x167 [C:\Users\WDKRemoteUser.DESKTOP-1ODDJ59\code\suite\lib\usb\windows\USBDriver\USBDriver\Async.cpp @ 90]
USBDriver!Queue2EvtIoDeviceControl+0x10e9 [C:\Users\WDKRemoteUser.DESKTOP-1ODDJ59\code\suite\lib\usb\windows\USBDriver\USBDriver\NonAudioQueue.cpp @ 135]
Wdf01000!FxIoQueueIoDeviceControl::Invoke+0x41 [minkernel\wdf\framework\shared\inc\private\common\FxIoQueueCallbacks.hpp @ 226]
Wdf01000!FxIoQueue::DispatchRequestToDriver+0x162 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 3325]
Wdf01000!FxIoQueue::DispatchEvents+0x520 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 3125]
Wdf01000!FxIoQueue::QueueRequestFromForward+0x98 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 2496]
Wdf01000!FxIoQueue::ForwardRequestWorker+0x11b [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 1444]
Wdf01000!FxIoQueue::ForwardRequest+0x26 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 1781]
Wdf01000!imp_WdfRequestForwardToIoQueue+0xce [minkernel\wdf\framework\shared\core\fxrequestapi.cpp @ 3149]
USBDriver!WdfRequestForwardToIoQueue+0x22 [C:\Program Files (x86)\Windows Kits\10\Include\wdf\kmdf\1.15\wdfrequest.h @ 1583]
USBDriver!Queue1EvtIoDeviceControl+0x7f [C:\Users\WDKRemoteUser.DESKTOP-1ODDJ59\code\suite\lib\usb\windows\USBDriver\USBDriver\DefaultQueue.cpp @ 82]
Wdf01000!FxIoQueueIoDeviceControl::Invoke+0x41 [minkernel\wdf\framework\shared\inc\private\common\FxIoQueueCallbacks.hpp @ 226]
Wdf01000!FxIoQueue::DispatchRequestToDriver+0x162 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 3325]
Wdf01000!FxIoQueue::DispatchEvents+0x520 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 3125]
Wdf01000!FxIoQueue::QueueRequest+0xae [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 2371]
Wdf01000!FxPkgIo::DispatchStep2+0x5ac [minkernel\wdf\framework\shared\irphandlers\io\fxpkgio.cpp @ 469]
Wdf01000!FxPkgIo::DispatchStep1+0x627 [minkernel\wdf\framework\shared\irphandlers\io\fxpkgio.cpp @ 324]
Wdf01000!FxPkgIo::Dispatch+0x5d [minkernel\wdf\framework\shared\irphandlers\io\fxpkgio.cpp @ 119]
Wdf01000!DispatchWorker+0x6a [minkernel\wdf\framework\shared\core\fxdevice.cpp @ 1589]
Wdf01000!FxDevice::Dispatch+0x88 [minkernel\wdf\framework\shared\core\fxdevice.cpp @ 1603]
Wdf01000!FxDevice::DispatchWithLock+0x156 [minkernel\wdf\framework\shared\core\fxdevice.cpp @ 1447]
nt!IofCallDriver+0x55
nt!IopSynchronousServiceTail+0x34c
nt!IopXxxControlFile+0xc71
nt!NtDeviceIoControlFile+0x56
nt!KiSystemServiceCopyEnd+0x28
ntdll!NtDeviceIoControlFile+0x14
KERNELBASE!DeviceIoControl+0x6b
KERNEL32!DeviceIoControlImplementation+0x81
MyApp+0x4e3a4
USBDriver!doThings+0xc4 [C:\Users\WDKRemoteUser.DESKTOP-1ODDJ59\code\suite\lib\usb\windows\USBDriver\USBDriver\Async.cpp @ 83]
USBDriver!Queue2EvtIoDeviceControl+0x10e9 [C:\Users\WDKRemoteUser.DESKTOP-1ODDJ59\code\suite\lib\usb\windows\USBDriver\USBDriver\NonAudioQueue.cpp @ 135]
Wdf01000!FxIoQueueIoDeviceControl::Invoke+0x41 [minkernel\wdf\framework\shared\inc\private\common\FxIoQueueCallbacks.hpp @ 226]
Wdf01000!FxIoQueue::DispatchRequestToDriver+0x162 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 3325]
Wdf01000!FxIoQueue::DispatchEvents+0x520 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 3125]
Wdf01000!FxIoQueue::QueueRequestFromForward+0x98 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 2496]
Wdf01000!FxIoQueue::ForwardRequestWorker+0x11b [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 1444]
Wdf01000!FxIoQueue::ForwardRequest+0x26 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 1781]
Wdf01000!imp_WdfRequestForwardToIoQueue+0xce [minkernel\wdf\framework\shared\core\fxrequestapi.cpp @ 3149]
USBDriver!WdfRequestForwardToIoQueue+0x22 [C:\Program Files (x86)\Windows Kits\10\Include\wdf\kmdf\1.15\wdfrequest.h @ 1583]
USBDriver!Queue1EvtIoDeviceControl+0x7f [C:\Users\WDKRemoteUser.DESKTOP-1ODDJ59\code\suite\lib\usb\windows\USBDriver\USBDriver\DefaultQueue.cpp @ 82]
Wdf01000!FxIoQueueIoDeviceControl::Invoke+0x41 [minkernel\wdf\framework\shared\inc\private\common\FxIoQueueCallbacks.hpp @ 226]
Wdf01000!FxIoQueue::DispatchRequestToDriver+0x162 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 3325]
Wdf01000!FxIoQueue::DispatchEvents+0x520 [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 3125]
Wdf01000!FxIoQueue::QueueRequest+0xae [minkernel\wdf\framework\shared\irphandlers\io\fxioqueue.cpp @ 2371]
Wdf01000!FxPkgIo::DispatchStep2+0x5ac [minkernel\wdf\framework\shared\irphandlers\io\fxpkgio.cpp @ 469]
Wdf01000!FxPkgIo::DispatchStep1+0x627 [minkernel\wdf\framework\shared\irphandlers\io\fxpkgio.cpp @ 324]
Wdf01000!FxPkgIo::Dispatch+0x5d [minkernel\wdf\framework\shared\irphandlers\io\fxpkgio.cpp @ 119]
Wdf01000!DispatchWorker+0x6a [minkernel\wdf\framework\shared\core\fxdevice.cpp @ 1589]
Wdf01000!FxDevice::Dispatch+0x88 [minkernel\wdf\framework\shared\core\fxdevice.cpp @ 1603]
Wdf01000!FxDevice::DispatchWithLock+0x156 [minkernel\wdf\framework\shared\core\fxdevice.cpp @ 1447]
nt!IofCallDriver+0x55
nt!IopSynchronousServiceTail+0x34c
nt!IopXxxControlFile+0xc71
nt!NtDeviceIoControlFile+0x56
nt!KiSystemServiceCopyEnd+0x28
ntdll!NtDeviceIoControlFile+0x14
KERNELBASE!DeviceIoControl+0x121
KERNEL32!DeviceIoControlImplementation+0x81
MyApp+0x8459f