intel/virtio: Preserve errno properly when handling ioctl
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Avoid changing errno when ioctl succeeds.

Fixes: b06d759a93 ("intel: Add virtio-gpu native context")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15446
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41512>
This commit is contained in:
Dmitry Osipenko 2026-05-12 18:59:45 +03:00 committed by Marge Bot
parent 0429a73f47
commit 85cb633871

View file

@ -696,15 +696,15 @@ intel_virtio_prime_handle_to_fd(struct intel_virtio_device *dev,
int
intel_virtio_ioctl(int fd, unsigned long cmd, void *req)
{
int orig_errno = errno;
struct intel_virtio_device *dev = fd_to_intel_virtio_device(fd);
if (!dev) {
errno = orig_errno;
/* this is a real phys device if not bound to virtio */
return intel_virtio_ioctl_errno(fd, cmd, req);
return ioctl(fd, cmd, req);
}
int orig_errno = errno;
/*
* Special case for legacy ioctls that have same NR as extended ioctl
* and need to be handled differently.