Commit 007cec79b2 for qemu.org
commit 007cec79b2fe5bdfb72748d1dce7a30d35da648a
Author: Aastha Rawat <aastharawat@linux.microsoft.com>
Date: Thu Apr 9 11:53:07 2026 +0000
accel/mshv: return correct errno value from ioeventfd failure
Returning the raw ioctl return value results in misleading error
message. Ensure that actual failure reason is propagated by returning
-errno for ioeventfd failure.
Signed-off-by: Aastha Rawat <aastharawat@linux.microsoft.com>
Reviewed-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260409-fix_ioevent-v1-2-053b810ae6fb@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
index e1a8d62f8d..58af674bd9 100644
--- a/accel/mshv/mshv-all.c
+++ b/accel/mshv/mshv-all.c
@@ -275,7 +275,12 @@ static int ioeventfd(int vm_fd, int event_fd, uint64_t addr, Datamatch dm,
}
}
- return ioctl(vm_fd, MSHV_IOEVENTFD, &args);
+ int ret = ioctl(vm_fd, MSHV_IOEVENTFD, &args);
+ if (ret < 0) {
+ return -errno;
+ }
+
+ return ret;
}
static int unregister_ioevent(int vm_fd, int event_fd, uint64_t mmio_addr,