summaryrefslogtreecommitdiffstats
path: root/hw/virtio
diff options
context:
space:
mode:
authorMarc-André Lureau2016-07-26 23:15:09 +0200
committerMichael S. Tsirkin2016-07-28 23:33:47 +0200
commitdf3485a14821edf75b1d3ee6ca38cd80fa989dbf (patch)
tree8d35a94b1d2a3d86e17a628909cfe931564bfa01 /hw/virtio
parentqemu-char: fix qemu_chr_fe_set_msgfds() crash when disconnected (diff)
downloadqemu-df3485a14821edf75b1d3ee6ca38cd80fa989dbf.tar.gz
qemu-df3485a14821edf75b1d3ee6ca38cd80fa989dbf.tar.xz
qemu-df3485a14821edf75b1d3ee6ca38cd80fa989dbf.zip
vhost-user: call set_msgfds unconditionally
It is fine to call set_msgfds() with 0 fd, and ensures any previous fd array is cleared. 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>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/vhost-user.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 495e09fd4e..f01b92f512 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -187,9 +187,7 @@ static int vhost_user_write(struct vhost_dev *dev, VhostUserMsg *msg,
return 0;
}
- if (fd_num) {
- qemu_chr_fe_set_msgfds(chr, fds, fd_num);
- }
+ qemu_chr_fe_set_msgfds(chr, fds, fd_num);
return qemu_chr_fe_write_all(chr, (const uint8_t *) msg, size) == size ?
0 : -1;