libvhost-user: fail vu_message_write() if sendmsg() is failing
commit92b58bc7e9086e489295040d408118a81c47b31d
authorStefano Garzarella <sgarzare@redhat.com>
Tue, 18 Jun 2024 10:00:33 +0000 (18 12:00 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 2 Jul 2024 13:27:56 +0000 (2 09:27 -0400)
tree271dfd7ea95a632336a3498fc499d3592f1b4eac
parent516dfbb783484959cf33f051864f2e44cbed45ca
libvhost-user: fail vu_message_write() if sendmsg() is failing

In vu_message_write() we use sendmsg() to send the message header,
then a write() to send the payload.

If sendmsg() fails we should avoid sending the payload, since we
were unable to send the header.

Discovered before fixing the issue with the previous patch, where
sendmsg() failed on macOS due to wrong parameters, but the frontend
still sent the payload which the backend incorrectly interpreted
as a wrong header.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20240618100043.144657-4-sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
subprojects/libvhost-user/libvhost-user.c