From f886acdcc6017cb04a48ef6fdea6c3d10a0b72c3 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Tue, 5 Nov 2024 13:14:43 +0100 Subject: [PATCH] qemu-usb: limit control transfer to 1 sec timeout Fix genodelabs/genode#5376 --- repos/libports/src/lib/qemu-usb/host.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/repos/libports/src/lib/qemu-usb/host.cc b/repos/libports/src/lib/qemu-usb/host.cc index d4f5d85e6f..977e26feb9 100644 --- a/repos/libports/src/lib/qemu-usb/host.cc +++ b/repos/libports/src/lib/qemu-usb/host.cc @@ -274,6 +274,13 @@ class Device : public List_model::Element struct Urb : Usb::Device::Urb { + /** + * Unconditionally set control transfer timeout to 1 sec, + * otherwise it can block a device forever, as we do not + * cancel control transfers yet in this backend. + */ + enum { CONTROL_XFER_TIMEOUT = 1000 }; + using Request_type = Usb::Device::Packet_descriptor::Request_type::access_t; @@ -289,7 +296,8 @@ class Device : public List_model::Element : Usb::Device::Urb(device._device, request, (Request_type)request_type, - value, index, size), + value, index, size, + CONTROL_XFER_TIMEOUT), _packet(packet) { } };