USB: Refuse transfer submission on pipes that are being removed.

This mostly only matters for the Device DefaultPipe, which is still
accesible even after its USBID has been put, but it makes sense to
do this in general, too.

Change-Id: I6711f1ce8fe79dff54927e3b5e60dec15bb58b14
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4489
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2021-09-20 16:28:03 +00:00
committed by waddlesplash
parent 2f496b3095
commit 2ce316ccc8
@@ -68,6 +68,9 @@ Pipe::SetHubInfo(int8 address, uint8 port)
status_t
Pipe::SubmitTransfer(Transfer *transfer)
{
if (USBID() == UINT32_MAX)
return B_NO_INIT;
// ToDo: keep track of all submited transfers to be able to cancel them
return GetBusManager()->SubmitTransfer(transfer);
}
@@ -444,6 +447,9 @@ ControlPipe::QueueRequest(uint8 requestType, uint8 request, uint16 value,
if (dataLength > 0 && data == NULL)
return B_BAD_VALUE;
if (USBID() == UINT32_MAX)
return B_NO_INIT;
usb_request_data *requestData = new(std::nothrow) usb_request_data;
if (!requestData)
return B_NO_MEMORY;