InvalidReqAccess rule (kmdf)

The InvalidReqAccess rule specifies that requests are not accessed after they are completed or canceled. This rule might overlap with other rules, such as rules that check for double completion, or rules that check for requests have been marked cancelable two times.

A request is considered invalid if it is completed, marked cancelable, or canceled after it was sent. After the request is considered invalid, the request cannot be passed to WdfRequestXxx functions, except when the driver calls WdfRequestUnmarkCancelable if the request was previously marked cancelable.

This rule is similar to the InvalidReqAccessLocal rule; however, the InvalidReqAccessLocal rule is only performed within the default I/O queue callback functions.

Driver model: KMDF

How to test

At compile time

Run Static Driver Verifier and specify the InvalidReqAccess rule.

Use the following steps to run an analysis of your code:
  1. Prepare your code (use role type declarations).
  2. Run Static Driver Verifier.
  3. View and analyze the results.

For more information, see Using Static Driver Verifier to Find Defects in Drivers.

Applies to

WdfRequestAllocateTimer
WdfRequestCancelSentRequest
WdfRequestChangeTarget
WdfRequestComplete
WdfRequestCompleteWithInformation
WdfRequestCompleteWithPriorityBoost
WdfRequestFormatRequestUsingCurrentType
WdfRequestForwardToIoQueue
WdfRequestGetCompletionParams
WdfRequestGetFileObject
WdfRequestGetInformation
WdfRequestGetIoQueue
WdfRequestGetParameters
WdfRequestGetRequestorMode
WdfRequestIsFrom32BitProcess
WdfRequestMarkCancelable
WdfRequestMarkCancelableEx
WdfRequestProbeAndLockUserBufferForRead
WdfRequestProbeAndLockUserBufferForWrite
WdfRequestRequeue
WdfRequestRetrieveInputBuffer
WdfRequestRetrieveInputMemory
WdfRequestRetrieveInputWdmMdl
WdfRequestRetrieveOutputBuffer
WdfRequestRetrieveOutputMemory
WdfRequestRetrieveOutputWdmMdl
WdfRequestRetrieveUnsafeUserInputBuffer
WdfRequestRetrieveUnsafeUserOutputBuffer
WdfRequestReuse
WdfRequestSend
WdfRequestSetCompletionRoutine
WdfRequestSetInformation
WdfRequestUnmarkCancelable
WdfRequestWdmFormatUsingStackLocation
WdfRequestWdmGetIrp