|
|
69c2b8 |
From 8010a15523e896ca2f2436432602210cab793f87 Mon Sep 17 00:00:00 2001
|
|
|
69c2b8 |
From: David Marchand <david.marchand@redhat.com>
|
|
|
69c2b8 |
Date: Mon, 25 Jul 2022 22:32:03 +0200
|
|
|
69c2b8 |
Subject: [PATCH] vhost: fix virtqueue use after free on NUMA reallocation
|
|
|
69c2b8 |
|
|
|
69c2b8 |
[ upstream commit 0b2a2ca35037d6a5168f0832c11d9858b8ae946a ]
|
|
|
69c2b8 |
|
|
|
69c2b8 |
translate_ring_addresses (via numa_realloc) may change a virtio device and
|
|
|
69c2b8 |
virtio queue.
|
|
|
69c2b8 |
The virtqueue object must be refreshed before accessing the lock.
|
|
|
69c2b8 |
|
|
|
69c2b8 |
Fixes: 04c27cb673b9 ("vhost: fix unsafe vring addresses modifications")
|
|
|
69c2b8 |
|
|
|
69c2b8 |
Signed-off-by: David Marchand <david.marchand@redhat.com>
|
|
|
69c2b8 |
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
|
|
|
69c2b8 |
---
|
|
|
69c2b8 |
lib/vhost/vhost_user.c | 1 +
|
|
|
69c2b8 |
1 file changed, 1 insertion(+)
|
|
|
69c2b8 |
|
|
|
69c2b8 |
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
|
|
|
69c2b8 |
index df780fd7d6..2b45e35d4a 100644
|
|
|
69c2b8 |
--- a/lib/vhost/vhost_user.c
|
|
|
69c2b8 |
+++ b/lib/vhost/vhost_user.c
|
|
|
69c2b8 |
@@ -2575,6 +2575,7 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg,
|
|
|
69c2b8 |
if (is_vring_iotlb(dev, vq, imsg)) {
|
|
|
69c2b8 |
rte_spinlock_lock(&vq->access_lock);
|
|
|
69c2b8 |
*pdev = dev = translate_ring_addresses(dev, i);
|
|
|
69c2b8 |
+ vq = dev->virtqueue[i];
|
|
|
69c2b8 |
rte_spinlock_unlock(&vq->access_lock);
|
|
|
69c2b8 |
}
|
|
|
69c2b8 |
}
|
|
|
69c2b8 |
--
|
|
|
69c2b8 |
2.37.3
|
|
|
69c2b8 |
|