@samitouri / QOSamiQemu / commits / 007cec79b2

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>

Aastha Rawat committed Apr 9, 2026 at 11:53 UTC 007cec79b2fe5bdfb72748d1dce7a30d35da648a
1 file changed +6 -1
accel/mshv/mshv-all.c
+6 -1
@@ -275,7 +275,12 @@ static int ioeventfd(int vm_fd, int event_fd, uint64_t addr, Datamatch dm,
275 }
276 }
277
278 - return ioctl(vm_fd, MSHV_IOEVENTFD, &args);
278 + int ret = ioctl(vm_fd, MSHV_IOEVENTFD, &args);
279 + if (ret < 0) {
280 + return -errno;
281 + }
282 +
283 + return ret;
284 }
285
286 static int unregister_ioevent(int vm_fd, int event_fd, uint64_t mmio_addr,