@samitouri / QOSamiQemu / commits / ee4ffe99dd

ui/input-linux: close evdev fd when qemu_set_blocking fails

input_linux_complete() opens the evdev node before switching it to non-blocking mode. If qemu_set_blocking() fails, the function returns without closing the file descriptor. The finalize path only closes initialized devices, so this leaks the fd on an error path. Jump to err_close when qemu_set_blocking() fails so the descriptor is released before returning. Fixes: c7b1172026a0 ("ui: replace qemu_set_nonblock()") Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260408024024.606222-1-zhaoguohan@kylinos.cn>

GuoHan Zhao committed Apr 8, 2026 at 10:40 UTC ee4ffe99dd763d7e7edac64782222b98053a07e7
1 file changed +1 -1
ui/input-linux.c
+1 -1
@@ -316,7 +316,7 @@ static void input_linux_complete(UserCreatable *uc, Error **errp)
316 return;
317 }
318 if (!qemu_set_blocking(il->fd, false, errp)) {
319 - return;
319 + goto err_close;
320 }
321
322 rc = ioctl(il->fd, EVIOCGVERSION, &ver);