diff options
author | Kevin Wolf <kwolf@redhat.com> | 2022-04-07 15:36:57 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2022-05-04 15:55:23 +0200 |
commit | a81d8d4a7203e4be392f9ad37af104759b7cbda5 (patch) | |
tree | 33732983c7d7ab8d292ddefedf7d50fa29c144db /subprojects | |
parent | 5ebfdeb21223e0406a711decbb2baceb5ec8c416 (diff) | |
download | qemu-a81d8d4a7203e4be392f9ad37af104759b7cbda5.zip qemu-a81d8d4a7203e4be392f9ad37af104759b7cbda5.tar.gz qemu-a81d8d4a7203e4be392f9ad37af104759b7cbda5.tar.bz2 |
vhost-user: Don't pass file descriptor for VHOST_USER_REM_MEM_REG
The spec clarifies now that QEMU should not send a file descriptor in a
request to remove a memory region. Change it accordingly.
For libvhost-user, this is a bug fix that makes it compatible with
rust-vmm's implementation that doesn't send a file descriptor. Keep
accepting, but ignoring a file descriptor for compatibility with older
QEMU versions.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20220407133657.155281-4-kwolf@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'subprojects')
-rw-r--r-- | subprojects/libvhost-user/libvhost-user.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index eccaff5..d0041c8 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -822,15 +822,15 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { int i; bool found = false; - if (vmsg->fd_num != 1) { + if (vmsg->fd_num > 1) { vmsg_close_fds(vmsg); - vu_panic(dev, "VHOST_USER_REM_MEM_REG received %d fds - only 1 fd " + vu_panic(dev, "VHOST_USER_REM_MEM_REG received %d fds - at most 1 fd " "should be sent for this message type", vmsg->fd_num); return false; } if (vmsg->size < VHOST_USER_MEM_REG_SIZE) { - close(vmsg->fds[0]); + vmsg_close_fds(vmsg); vu_panic(dev, "VHOST_USER_REM_MEM_REG requires a message size of at " "least %d bytes and only %d bytes were received", VHOST_USER_MEM_REG_SIZE, vmsg->size); @@ -877,7 +877,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { vu_panic(dev, "Specified region not found\n"); } - close(vmsg->fds[0]); + vmsg_close_fds(vmsg); return false; } |