aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-09-28 17:24:54 +0100
committerGitHub <noreply@github.com>2021-09-28 17:24:54 +0100
commit2789a978b9e710ccb17bc4f7de884743abd63297 (patch)
treec3a7cee9115360da7146953bd1a8a7b55f049ff3 /lib
parent2cc236ee84ed70a6df421e5352994ac4eb03de21 (diff)
downloadlibvfio-user-2789a978b9e710ccb17bc4f7de884743abd63297.zip
libvfio-user-2789a978b9e710ccb17bc4f7de884743abd63297.tar.gz
libvfio-user-2789a978b9e710ccb17bc4f7de884743abd63297.tar.bz2
fix issue with get_region_io_fds when fd = -1 (#606)
An unmappable region should still allow io fds, as they are orthogonal. Co-authored-by: John Levon <john.levon@nutanix.com> Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libvfio-user.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c
index 8881dc7..69aeb36 100644
--- a/lib/libvfio-user.c
+++ b/lib/libvfio-user.c
@@ -558,7 +558,7 @@ handle_device_get_region_io_fds(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg)
assert(msg != NULL);
assert(msg->out_fds == NULL);
- if (msg->in_size != sizeof(vfio_user_region_io_fds_request_t)) {
+ if (msg->in_size < sizeof(vfio_user_region_io_fds_request_t)) {
return ERROR_INT(EINVAL);
}
@@ -576,10 +576,6 @@ handle_device_get_region_io_fds(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg)
vfu_reg = &vfu_ctx->reg_info[req->index];
- if (vfu_reg->fd == -1) {
- return ERROR_INT(EINVAL);
- }
-
LIST_FOREACH(sub_reg, &vfu_reg->subregions, entry) {
nr_sub_reg++;
}