Skip to content

Commit

Permalink
vhost-user: check qemu_chr_fe_set_msgfds() return value
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
elmarco authored and mstsirkin committed Jul 28, 2016
1 parent df3485a commit 6fab2f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hw/virtio/vhost-user.c
Expand Up @@ -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;
Expand Down

0 comments on commit 6fab2f3

Please sign in to comment.