diff --git a/repos/libports/src/lib/libdrm/ioctl_lima.cc b/repos/libports/src/lib/libdrm/ioctl_lima.cc index a4255a83a8..8c010021e8 100644 --- a/repos/libports/src/lib/libdrm/ioctl_lima.cc +++ b/repos/libports/src/lib/libdrm/ioctl_lima.cc @@ -436,8 +436,14 @@ class Lima::Call } while (true); } - void _wait_for_syncobj(unsigned int handle) + int _wait_for_syncobj(int fd) { + if (fd < SYNC_FD) { + Genode::warning("ignore invalid sync fd: ", fd); + return -1; + } + + unsigned const handle = fd - SYNC_FD; Syncobj::Id_space::Id syncobj_id { .value = handle }; try { @@ -453,7 +459,12 @@ class Lima::Call } while (true); }; _syncobj_space.apply(syncobj_id, wait); - } catch (Genode::Id_space::Unknown_id) { } + } catch (Genode::Id_space::Unknown_id) { + Genode::warning("ignore unknown sync fd: ", fd); + return -1; + } + + return 0; } template @@ -807,6 +818,11 @@ class Lima::Call : _generic_ioctl(command_number(request), arg); } + int wait_for_syncobj(int fd) + { + return _wait_for_syncobj(fd); + } + void *mmap(unsigned long offset, unsigned long /* size */) { /* @@ -907,8 +923,8 @@ int lima_drm_poll(int fd) return -1; } - int const handle = fd - Lima::Call::SYNC_FD; - _drm->wait_for_syncobj((unsigned)handle); + int const ret = _drm->wait_for_syncobj(fd); + pthread_mutex_unlock(&poll_mutex); - return 0; + return ret; }