Skip to content

Commit

Permalink
util/vhost-user-server: check EOF when reading payload
Browse files Browse the repository at this point in the history
Unexpected EOF is an error that must be reported.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20200924151549.913737-9-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
stefanhaRH committed Oct 23, 2020
1 parent 8c7f7cb commit edaf620
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions util/vhost-user-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ vu_message_read(VuDev *vu_dev, int conn_fd, VhostUserMsg *vmsg)
};
if (vmsg->size) {
rc = qio_channel_readv_all_eof(ioc, &iov_payload, 1, &local_err);
if (rc == -1) {
error_report_err(local_err);
if (rc != 1) {
if (local_err) {
error_report_err(local_err);
}
goto fail;
}
}
Expand Down

0 comments on commit edaf620

Please sign in to comment.