Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/windows/wdfserial/QCPNP.c
Original file line number Diff line number Diff line change
Expand Up @@ -3112,6 +3112,18 @@ NTSTATUS QCPNP_ResetUsbPipe
)
{
NTSTATUS status = STATUS_SUCCESS;

if (usbPipe == NULL)
{
QCSER_DbgPrint
(
QCSER_DBG_MASK_CIRP,
QCSER_DBG_LEVEL_ERROR,
("<%ws> QCPNP_ResetUsbPipe called with NULL pipe, skipping\n", pDevContext->PortName)
);
return STATUS_SUCCESS;
}

WDFIOTARGET ioTarget = WdfUsbTargetPipeGetIoTarget(usbPipe);
WDF_REQUEST_SEND_OPTIONS syncReqOptions;
WDF_REQUEST_SEND_OPTIONS_INIT(&syncReqOptions, 0);
Expand Down
20 changes: 18 additions & 2 deletions src/windows/wdfserial/QCRD.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ void QCRD_ReadRequestHandlerThread
PREQUEST_CONTEXT pReqContext;
PDEVICE_CONTEXT pDevContext = pContext;
ULONG devErrCnt = 0;
WDFIOTARGET ioTarget = WdfUsbTargetPipeGetIoTarget(pDevContext->BulkIN);
PKWAIT_BLOCK pWaitBlock = ExAllocatePoolUninitialized(NonPagedPoolNx, (READ_THREAD_RESUME_EVENT_COUNT) * sizeof(KWAIT_BLOCK), '3gaT');
WDFIOTARGET ioTarget = NULL;
PKWAIT_BLOCK pWaitBlock = NULL;
BOOLEAN bRunning = TRUE;
BOOLEAN bDeviceOpened = FALSE;
BOOLEAN bDeviceAwaken = FALSE;
Expand All @@ -144,6 +144,22 @@ void QCRD_ReadRequestHandlerThread
WDF_REQUEST_PARAMETERS requestParam; // for application requests
PRING_BUFFER rxBuffer = &pDevContext->ReadRingBuffer;

if (pDevContext->BulkIN == NULL)
{
QCSER_DbgPrint
(
QCSER_DBG_MASK_READ,
QCSER_DBG_LEVEL_ERROR,
("<%ws> RIRP: QCRD_ReadRequestHandlerThread ERROR no USB pipe for read, exiting\n", pDevContext->PortName)
);
KeSetEvent(&pDevContext->ReadThreadStartedEvent, IO_NO_INCREMENT, FALSE);
PsTerminateSystemThread(STATUS_SUCCESS);
return;
}

ioTarget = WdfUsbTargetPipeGetIoTarget(pDevContext->BulkIN);
pWaitBlock = ExAllocatePoolUninitialized(NonPagedPoolNx, (READ_THREAD_RESUME_EVENT_COUNT) * sizeof(KWAIT_BLOCK), '3gaT');

if (pWaitBlock == NULL)
{
WdfDeviceSetFailed(pDevContext->Device, WdfDeviceFailedNoRestart);
Expand Down
2 changes: 1 addition & 1 deletion src/windows/wdfserial/QCWT.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ void QCWT_WriteRequestHandlerThread
WDF_REQUEST_PARAMETERS_INIT(&writeParam);
WdfRequestGetParameters(request, &writeParam);
QCWT_EvtIoWrite(pDevContext->WriteQueue, request, writeParam.Parameters.Write.Length);
if (gVendorConfig.EnableZeroLengthPacket && (writeParam.Parameters.Write.Length % pDevContext->wMaxPktSize == 0))
if (gVendorConfig.EnableZeroLengthPacket && (pDevContext->wMaxPktSize != 0) && (writeParam.Parameters.Write.Length % pDevContext->wMaxPktSize == 0))
{
#ifdef QCUSB_MUX_PROTOCOL
if (pDevContext->DeviceFunction != QCUSB_DEV_FUNC_LPC)
Expand Down
Loading