From 85cb633871a50747ede73af49c9cb343c778d6cc Mon Sep 17 00:00:00 2001 From: Dmitry Osipenko Date: Tue, 12 May 2026 18:59:45 +0300 Subject: [PATCH] intel/virtio: Preserve errno properly when handling ioctl Avoid changing errno when ioctl succeeds. Fixes: b06d759a9365 ("intel: Add virtio-gpu native context") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15446 Reviewed-by: Lionel Landwerlin Signed-off-by: Dmitry Osipenko Part-of: --- src/intel/dev/virtio/i915_virtio_ccmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/intel/dev/virtio/i915_virtio_ccmd.c b/src/intel/dev/virtio/i915_virtio_ccmd.c index bfc8cc5f572..ad482fdf4a5 100644 --- a/src/intel/dev/virtio/i915_virtio_ccmd.c +++ b/src/intel/dev/virtio/i915_virtio_ccmd.c @@ -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.