From: GuoHan Zhao Date: Wed, 8 Apr 2026 02:40:24 +0000 (+0800) Subject: ui/input-linux: close evdev fd when qemu_set_blocking fails X-Git-Tag: v11.1.0-rc0~161^2~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ee4ffe99dd763d7e7edac64782222b98053a07e7;p=thirdparty%2Fqemu.git 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 Reviewed-by: Marc-André Lureau Message-ID: <20260408024024.606222-1-zhaoguohan@kylinos.cn> --- diff --git a/ui/input-linux.c b/ui/input-linux.c index c16726a3b79..74bc8511428 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -316,7 +316,7 @@ static void input_linux_complete(UserCreatable *uc, Error **errp) return; } if (!qemu_set_blocking(il->fd, false, errp)) { - return; + goto err_close; } rc = ioctl(il->fd, EVIOCGVERSION, &ver);