Commit 152f7dd3b0 for qemu.org

commit 152f7dd3b04f1ad8e99248610c74f876e0da2107
Author: Thanos Makatos <thanos.makatos@nutanix.com>
Date:   Tue Jul 21 12:26:52 2026 +0000

    vfio-user: vfio_user_get_region_info: respect max_xfer_size

    Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
    Fixes: 667866d66620 ("vfio-user: implement VFIO_USER_DEVICE_GET_REGION_INFO")
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Link: https://lore.kernel.org/qemu-devel/20260721122643.30985-3-thanos.makatos@nutanix.com
    Signed-off-by: Cédric Le Goater <clg@redhat.com>

diff --git a/hw/vfio-user/device.c b/hw/vfio-user/device.c
index e58167a818..8350bb2c01 100644
--- a/hw/vfio-user/device.c
+++ b/hw/vfio-user/device.c
@@ -137,6 +137,10 @@ static int vfio_user_get_region_info(VFIOUserProxy *proxy,
         error_printf("vfio_user_get_region_info argsz too large\n");
         return -E2BIG;
     }
+    if (size > proxy->max_xfer_size) {
+        error_printf("vfio_user_get_region_info argsz too large\n");
+        return -E2BIG;
+    }

     if (fds != NULL && fds->send_fds != 0) {
         error_printf("vfio_user_get_region_info can't send FDs\n");