vioser: Check ActionFlags before request unmark
@@ -1352,11 +1352,18 @@ VOID VIOSerialPortWriteIoStop(IN WDFQUEUE Queue,
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE, "--> %s\n", __FUNCTION__);
- if (WdfRequestUnmarkCancelable(Request) == STATUS_CANCELLED)
+ if (ActionFlags & WdfRequestStopRequestCancelable)
+ {
+ NTSTATUS status = WdfRequestUnmarkCancelable(Request);
+ __analysis_assume(status != STATUS_NOT_SUPPORTED);
+ if (status == STATUS_CANCELLED)
{
WdfRequestStopAcknowledge(Request, FALSE);
+ goto end_io_stop;
+ }
}
- else if (ActionFlags & WdfRequestStopActionSuspend)
+
+ if (ActionFlags & WdfRequestStopActionSuspend)
{
WdfRequestStopAcknowledge(Request, TRUE);
}
@@ -1383,6 +1390,7 @@ VOID VIOSerialPortWriteIoStop(IN WDFQUEUE Queue,
WdfRequestComplete(Request, STATUS_UNSUCCESSFUL);
}
+end_io_stop:
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE, "<-- %s\n", __FUNCTION__);
}
