vioserial: fix SDV issues
EvtIoStopCancel:
Requires EvtIoStop to unmark request cancellable
EvtIoStopCompleteOrStopAck:
Requires EvIoStop to complete/cancel/postpone request
@@ -1352,16 +1352,20 @@ VOID VIOSerialPortWriteIoStop(IN WDFQUEUE Queue,
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE, "--> %s\n", __FUNCTION__);
- WdfSpinLockAcquire(pport->OutVqLock);
- if (ActionFlags & WdfRequestStopActionSuspend)
+ if (WdfRequestUnmarkCancelable(Request) == STATUS_CANCELLED)
{
WdfRequestStopAcknowledge(Request, FALSE);
}
- else if (ActionFlags & WdfRequestStopActionPurge)
+ else if (ActionFlags & WdfRequestStopActionSuspend)
{
- if (WdfRequestUnmarkCancelable(Request) != STATUS_CANCELLED)
+ WdfRequestStopAcknowledge(Request, FALSE);
+ }
+ else if (ActionFlags & WdfRequestStopActionPurge)
{
- PSINGLE_LIST_ENTRY iter = &pport->WriteBuffersList;
+ PSINGLE_LIST_ENTRY iter;
+
+ WdfSpinLockAcquire(pport->OutVqLock);
+ iter = &pport->WriteBuffersList;
while ((iter = iter->Next) != NULL)
{
PWRITE_BUFFER_ENTRY entry = CONTAINING_RECORD(iter, WRITE_BUFFER_ENTRY, ListEntry);
@@ -1372,9 +1376,12 @@ VOID VIOSerialPortWriteIoStop(IN WDFQUEUE Queue,
}
}
WdfRequestComplete(Request, STATUS_OBJECT_NO_LONGER_EXISTS);
+ WdfSpinLockRelease(pport->OutVqLock);
}
+ else
+ {
+ WdfRequestComplete(Request, STATUS_UNSUCCESSFUL);
}
- WdfSpinLockRelease(pport->OutVqLock);
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE, "<-- %s\n", __FUNCTION__);
}
