]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
util/vhost-user-server: check EOF when reading payload
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 24 Sep 2020 15:15:44 +0000 (16:15 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 23 Oct 2020 12:42:16 +0000 (13:42 +0100)
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>
util/vhost-user-server.c

index a7b7a9897f11c757ed7d826f0f71834ba61bdd22..981908fef090fe9add0d1fa63be82a962ead27aa 100644 (file)
@@ -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;
         }
     }