From cccb76373787c47c57d0930e6853d85fd26bb378 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Thu, 6 Jul 2023 15:40:44 +0200 Subject: [PATCH] lx_emul usb: handle RPC calls after async-URBS Prevent missing new RPC calls handed over to a Linux task of a corresponding usb-device, while that task blocked during enqueuing of asynchronous URBs. Fixed genodelabs/genode#4955 --- repos/dde_linux/src/lib/lx_emul/usb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/repos/dde_linux/src/lib/lx_emul/usb.c b/repos/dde_linux/src/lib/lx_emul/usb.c index 9baf549220..dc8f111a8b 100644 --- a/repos/dde_linux/src/lib/lx_emul/usb.c +++ b/repos/dde_linux/src/lib/lx_emul/usb.c @@ -691,6 +691,15 @@ static int poll_usb_device(void * args) handle_rpc(data); while (check_for_urb(data->dev)) ; while (check_for_urb_done(&data->file)) ; + + /* + * we have to check for RPC handling once again, + * during asynchronous URB handling the Linux task might + * have been blocked and a new RPC entered the entrypoint + */ + handle_rpc(data); + + /* check if device got removed */ if (!data->dev) { struct usb_device * udev = find_usb_device(bus, dev); release_device(data, udev ? 1 : 0);