summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-07-27 01:15:10 +0400
committerMichael S. Tsirkin <mst@redhat.com>2016-07-29 00:33:48 +0300
commit6fab2f3f6064ad0a712c6d9213b9151bcc87c3d6 (patch)
tree41cb085df52db90ec364bf991d7dc9ed14ab5409
parentdf3485a14821edf75b1d3ee6ca38cd80fa989dbf (diff)
downloadqemu-6fab2f3f6064ad0a712c6d9213b9151bcc87c3d6.tar.gz
qemu-6fab2f3f6064ad0a712c6d9213b9151bcc87c3d6.tar.bz2
qemu-6fab2f3f6064ad0a712c6d9213b9151bcc87c3d6.zip
vhost-user: check qemu_chr_fe_set_msgfds() return value
Check qemu_chr_fe_set_msgfds() for errors, to make sure the message to be sent is correct. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/virtio/vhost-user.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index f01b92f512..5dae49615c 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -187,7 +187,9 @@ static int vhost_user_write(struct vhost_dev *dev, VhostUserMsg *msg,
return 0;
}
- qemu_chr_fe_set_msgfds(chr, fds, fd_num);
+ if (qemu_chr_fe_set_msgfds(chr, fds, fd_num) < 0) {
+ return -1;
+ }
return qemu_chr_fe_write_all(chr, (const uint8_t *) msg, size) == size ?
0 : -1;