On 23.09.25 12:09, Markus Armbruster wrote:
ivshmem-flat's ivshmem_flat_add_vector() neglects to handle
qemu_set_blocking() failure.  It used to silently ignore errors there.
Recent commit 6f607941b1c (treewide: use qemu_set_blocking instead of
g_unix_set_fd_nonblocking) changed it to warn (without mentioning it
the commit message, tsk, tsk, tsk).

Yes, my fault.

Note that ivshmem-pci's process_msg_connect() handles this error.

Add a FIXME comment to mark the missing error handling.

Cc: Gustavo Romero <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>

Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>

---
  hw/misc/ivshmem-flat.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/hw/misc/ivshmem-flat.c b/hw/misc/ivshmem-flat.c
index e83e6c6ee9..27ee8c9218 100644
--- a/hw/misc/ivshmem-flat.c
+++ b/hw/misc/ivshmem-flat.c
@@ -138,6 +138,8 @@ static void ivshmem_flat_remove_peer(IvshmemFTState *s, 
uint16_t peer_id)
  static void ivshmem_flat_add_vector(IvshmemFTState *s, IvshmemPeer *peer,
                                      int vector_fd)
  {
+    Error *err = NULL;
+
      if (peer->vector_counter >= IVSHMEM_MAX_VECTOR_NUM) {
          trace_ivshmem_flat_add_vector_failure(peer->vector_counter,
                                                vector_fd, peer->id);
@@ -154,8 +156,10 @@ static void ivshmem_flat_add_vector(IvshmemFTState *s, 
IvshmemPeer *peer,
       * peer.
       */
      peer->vector[peer->vector_counter].id = peer->vector_counter;
-    /* WARNING: qemu_socket_set_nonblock() return code ignored */
-    qemu_set_blocking(vector_fd, false, &error_warn);
+    if (!qemu_set_blocking(vector_fd, false, &err)) {
+        /* FIXME handle the error */
+        warn_report_err(err);
+    }
      event_notifier_init_fd(&peer->vector[peer->vector_counter].event_notifier,
                             vector_fd);


--
Best regards,
Vladimir

Reply via email to