vhost: fail early when __vhost_add_used() fails
authorJason Wang <jasowang@redhat.com>
Mon, 14 Jul 2025 08:47:53 +0000 (16:47 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 1 Aug 2025 13:11:09 +0000 (09:11 -0400)
commitb4ba1207d45adaafa2982c035898b36af2d3e518
treea47e9d84639c4c20605bfb4ce5e9f616da12e4a1
parent7d9896e9f6d02d8aa85e63f736871f96c59a5263
vhost: fail early when __vhost_add_used() fails

This patch fails vhost_add_used_n() early when __vhost_add_used()
fails to make sure used idx is not updated with stale used ring
information.

Reported-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20250714084755.11921-2-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
drivers/vhost/vhost.c