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>
return;
}
if (!qemu_set_blocking(il->fd, false, errp)) {
- return;
+ goto err_close;
}
rc = ioctl(il->fd, EVIOCGVERSION, &ver);