From: xiongweimin <[email protected]>

The return value of ops->set_map() is currently ignored when handling
VHOST_IOTLB_BATCH_END. If the backend fails to program the IOTLB,
the VMM incorrectly believes the operation succeeded and may continue
with stale or incorrect mappings.

Propagate the error from ops->set_map() to the caller.

Signed-off-by: xiongweimin <[email protected]>
---
 drivers/vhost/vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index bb96b1aa5..b52d8d94e 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1298,7 +1298,7 @@ static int vhost_vdpa_process_iotlb_msg(struct vhost_dev 
*dev, u32 asid,
                break;
        case VHOST_IOTLB_BATCH_END:
                if (v->in_batch && ops->set_map)
-                       ops->set_map(vdpa, asid, iotlb);
+                       r = ops->set_map(vdpa, asid, iotlb);
                v->in_batch = false;
                break;
        default:

--
2.39.3


Reply via email to