XHCI: Use InitKernelAccess/PrepareKernelAccess properly.
* Actually check return codes of InitKernelAccess(). * WriteDescriptorChain accesses the memory in the IO vectors, so we need to PrepareKernelAccess before calling it. Fixes #14752.
This commit is contained in:
@@ -666,10 +666,12 @@ XHCI::SubmitControlRequest(Transfer *transfer)
|
|||||||
TRACE_ERROR("Invalid Endpoint");
|
TRACE_ERROR("Invalid Endpoint");
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
setupDescriptor->transfer = transfer;
|
status_t status = transfer->InitKernelAccess();
|
||||||
transfer->InitKernelAccess();
|
if (status != B_OK)
|
||||||
_LinkDescriptorForPipe(setupDescriptor, endpoint);
|
return status;
|
||||||
|
|
||||||
|
setupDescriptor->transfer = transfer;
|
||||||
|
_LinkDescriptorForPipe(setupDescriptor, endpoint);
|
||||||
TRACE("SubmitControlRequest() request linked\n");
|
TRACE("SubmitControlRequest() request linked\n");
|
||||||
|
|
||||||
TRACE("Endpoint status 0x%08" B_PRIx32 " 0x%08" B_PRIx32 " 0x%016" B_PRIx64 "\n",
|
TRACE("Endpoint status 0x%08" B_PRIx32 " 0x%08" B_PRIx32 " 0x%016" B_PRIx64 "\n",
|
||||||
@@ -695,6 +697,10 @@ XHCI::SubmitNormalRequest(Transfer *transfer)
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
bool directionIn = (pipe->Direction() == Pipe::In);
|
bool directionIn = (pipe->Direction() == Pipe::In);
|
||||||
|
|
||||||
|
status_t status = transfer->InitKernelAccess();
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
int32 trbCount = 0;
|
int32 trbCount = 0;
|
||||||
xhci_td *descriptor = CreateDescriptorChain(transfer->DataLength(), trbCount);
|
xhci_td *descriptor = CreateDescriptorChain(transfer->DataLength(), trbCount);
|
||||||
if (descriptor == NULL)
|
if (descriptor == NULL)
|
||||||
@@ -740,18 +746,14 @@ XHCI::SubmitNormalRequest(Transfer *transfer)
|
|||||||
|
|
||||||
if (!directionIn) {
|
if (!directionIn) {
|
||||||
TRACE("copying out iov count %ld\n", transfer->VectorCount());
|
TRACE("copying out iov count %ld\n", transfer->VectorCount());
|
||||||
|
transfer->PrepareKernelAccess();
|
||||||
WriteDescriptorChain(descriptor, transfer->Vector(),
|
WriteDescriptorChain(descriptor, transfer->Vector(),
|
||||||
transfer->VectorCount());
|
transfer->VectorCount());
|
||||||
}
|
}
|
||||||
/* memcpy(descriptor->buffer_log[index],
|
|
||||||
(uint8 *)transfer->Vector()[index].iov_base, transfer->VectorLength());
|
|
||||||
}*/
|
|
||||||
|
|
||||||
xhci_endpoint *endpoint = (xhci_endpoint *)pipe->ControllerCookie();
|
xhci_endpoint *endpoint = (xhci_endpoint *)pipe->ControllerCookie();
|
||||||
descriptor->transfer = transfer;
|
descriptor->transfer = transfer;
|
||||||
transfer->InitKernelAccess();
|
|
||||||
_LinkDescriptorForPipe(descriptor, endpoint);
|
_LinkDescriptorForPipe(descriptor, endpoint);
|
||||||
|
|
||||||
TRACE("SubmitNormalRequest() request linked\n");
|
TRACE("SubmitNormalRequest() request linked\n");
|
||||||
|
|
||||||
TRACE("Endpoint status 0x%08" B_PRIx32 " 0x%08" B_PRIx32 " 0x%016" B_PRIx64 "\n",
|
TRACE("Endpoint status 0x%08" B_PRIx32 " 0x%08" B_PRIx32 " 0x%016" B_PRIx64 "\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user