diff options
author | Stefan Hajnoczi | 2020-09-24 17:15:44 +0200 |
---|---|---|
committer | Stefan Hajnoczi | 2020-10-23 14:42:16 +0200 |
commit | edaf6205a3a58e09bf31b7ebd73d8fc470e96e07 (patch) | |
tree | 17a13fbd3e53ad7205ee20b4b007210c1370ce37 /util | |
parent | util/vhost-user-server: fix memory leak in vu_message_read() (diff) | |
download | qemu-edaf6205a3a58e09bf31b7ebd73d8fc470e96e07.tar.gz qemu-edaf6205a3a58e09bf31b7ebd73d8fc470e96e07.tar.xz qemu-edaf6205a3a58e09bf31b7ebd73d8fc470e96e07.zip |
util/vhost-user-server: check EOF when reading payload
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>
Diffstat (limited to 'util')
-rw-r--r-- | util/vhost-user-server.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c index a7b7a9897f..981908fef0 100644 --- a/util/vhost-user-server.c +++ b/util/vhost-user-server.c @@ -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; } } |