[PATCH 2/2] accel/mshv: return correct errno value from ioeventfd failure

Aastha Rawat posted 2 patches 2 days, 5 hours ago
Maintainers: Magnus Kulke <magnuskulke@linux.microsoft.com>, Wei Liu <wei.liu@kernel.org>
[PATCH 2/2] accel/mshv: return correct errno value from ioeventfd failure
Posted by Aastha Rawat 2 days, 5 hours ago
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>
---
 accel/mshv/mshv-all.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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,

-- 
2.45.4
Re: [PATCH 2/2] accel/mshv: return correct errno value from ioeventfd failure
Posted by Magnus Kulke 1 day, 2 hours ago
On Thu, Apr 09, 2026 at 11:53:07AM +0000, Aastha Rawat wrote:
> 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>
> ---
>  accel/mshv/mshv-all.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> 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,
> 

Reviewed-by: Magnus Kulke <magnuskulke@linux.microsoft.com>