Crash when calling WdfIoQueueStart from a Completion routine

The driver sends a request to a USB target and in the completion routine
calls WdfIoQueueStart at which point the driver crashes. The stack
backtrace after the crash shows that the requests from the queue are
dispatched in the context same as the completion routine and at IRQL=2.

Can’t WdfIoQueueStart called from a completion routine.


The CompletionRoutine callback function is called at IRQL <= DISPATCH_LEVEL.
WdfIoQueueStart: This method must be called at IRQL <= DISPATCH_LEVEL.

[/quote]



Vijairaj

You might want to include the actual bugcheck data displayed by executing
the '!analyze -v" command in windbg. Yes WdfIoQueueStart can be called at
DISPATCH_LEVEL, so unless there is a huge and obvious bug in the
implementation here, that is not the problem.

On 10/31/07, xxxxx@gmail.com wrote:
>
> The driver sends a request to a USB target and in the completion routine
> calls WdfIoQueueStart at which point the driver crashes. The stack
> backtrace after the crash shows that the requests from the queue are
> dispatched in the context same as the completion routine and at IRQL=2.
>
> Can’t WdfIoQueueStart called from a completion routine.
>
>
> The CompletionRoutine callback function is called at IRQL <=
> DISPATCH_LEVEL.
> WdfIoQueueStart: This method must be called at IRQL <= DISPATCH_LEVEL.
>
[/quote]

>
> –
> Vijairaj
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Mark Roddy

The EvtIoDeviceControl function has some KeWaitXXX calls with indefinite
timeout. I thought that by default the Top-of-stack drivers will be
called at PASSIVE_LEVEL, but for some reason, it’s not happening. I
explicitly set the ExecutionLevel of the device to
WdfExecutionLevelPassive and it works now as expected.


The EvtIoDeviceControl callback function can be called at IRQL <=
DISPATCH_LEVEL, unless the ExecutionLevel member of the device or
driver’s WDF_OBJECT_ATTRIBUTES structure is set to
WdfExecutionLevelPassive. (If your driver is at the top of its driver
stack, the callback function is called at IRQL = PASSIVE_LEVEL.)

[/quote]

Vijairaj R wrote:

The EvtIoDeviceControl function has some KeWaitXXX calls with
indefinite timeout.

Ok, so there’s your real problem. That’s a terrible design.