usbip-win2: Sometimes the usbip attach command may become blocked

Hi, I found that when using the usbip attach command, the user-space program gets blocked. Debugging revealed that the code is stuck at WdfRequestComplete(request, st) in the complete function.

_Function_class_(EVT_WDF_WORKITEM)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
PAGED void NTAPI complete(_In_ WDFWORKITEM wi)
{
        PAGED_CODE();
       ..........

        if (st != STATUS_PENDING) {
                TraceDbg("req %04x, %!STATUS!", ptr04x(request), st);
                WdfRequestComplete(request, st);    // ===> This line  will be blocked.
        }
}

Tracing the code, I found that the possible reason might be that the cleanupcallback function set in the create_workitem function is not being called by the WDF framework. Is my assumption correct?

PAGED auto create_workitem(_Out_ WDFWORKITEM &wi, _In_ WDFOBJECT parent)
{
        PAGED_CODE();

       .........
        attr.EvtCleanupCallback = workitem_cleanup;    // ====> This func was not called.
        attr.ParentObject = parent;

        return WdfWorkItemCreate(&cfg, &attr, &wi);
}

Please help confirm this issue. Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Oh, I see. After I disabled it, the issue didn’t occur again. Thank you.