patch 'vhost: fix check on virtqueue access in async registration' has been queued to stable release 21.11.6

Kevin Traynor ktraynor at redhat.com
Thu Nov 16 14:22:49 CET 2023


Hi,

FYI, your patch has been queued to stable release 21.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/21/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/201e1f617be367c49d95579f803931121a123069

Thanks.

Kevin

---
>From 201e1f617be367c49d95579f803931121a123069 Mon Sep 17 00:00:00 2001
From: Maxime Coquelin <maxime.coquelin at redhat.com>
Date: Fri, 20 Oct 2023 10:48:01 +0200
Subject: [PATCH] vhost: fix check on virtqueue access in async registration

[ upstream commit 867d31bed41c87510e860956ee6a67c047d98f87 ]

Acquiring the access lock is not enough to ensure
virtqueue's metadata such as vring pointers are valid.

The access status must also be checked.

Fixes: 78639d54563a ("vhost: introduce async enqueue registration API")

Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
Acked-by: David Marchand <david.marchand at redhat.com>
---
 lib/vhost/vhost.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
index 45e34e0df1..038baf53fd 100644
--- a/lib/vhost/vhost.c
+++ b/lib/vhost/vhost.c
@@ -1783,5 +1783,13 @@ rte_vhost_async_channel_register(int vid, uint16_t queue_id,
 
 	rte_spinlock_lock(&vq->access_lock);
+
+	if (unlikely(!vq->access_ok)) {
+		ret = -1;
+		goto out_unlock;
+	}
+
 	ret = async_channel_register(vid, queue_id, ops);
+
+out_unlock:
 	rte_spinlock_unlock(&vq->access_lock);
 
@@ -1846,4 +1854,9 @@ rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
 	}
 
+	if (unlikely(!vq->access_ok)) {
+		ret = -1;
+		goto out_unlock;
+	}
+
 	if (!vq->async) {
 		ret = 0;
@@ -1856,4 +1869,5 @@ rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
 	}
 
+out_unlock:
 	rte_spinlock_unlock(&vq->access_lock);
 
-- 
2.41.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-11-16 13:21:52.755227668 +0000
+++ 0007-vhost-fix-check-on-virtqueue-access-in-async-registr.patch	2023-11-16 13:21:52.401946232 +0000
@@ -1 +1 @@
-From 867d31bed41c87510e860956ee6a67c047d98f87 Mon Sep 17 00:00:00 2001
+From 201e1f617be367c49d95579f803931121a123069 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 867d31bed41c87510e860956ee6a67c047d98f87 ]
+
@@ -12 +13,0 @@
-Cc: stable at dpdk.org
@@ -21 +22 @@
-index f7e5602913..53318a54a3 100644
+index 45e34e0df1..038baf53fd 100644
@@ -24 +25 @@
-@@ -1860,5 +1860,13 @@ rte_vhost_async_channel_register(int vid, uint16_t queue_id)
+@@ -1783,5 +1783,13 @@ rte_vhost_async_channel_register(int vid, uint16_t queue_id,
@@ -26 +27 @@
- 	rte_rwlock_write_lock(&vq->access_lock);
+ 	rte_spinlock_lock(&vq->access_lock);
@@ -33 +34 @@
- 	ret = async_channel_register(dev, vq);
+ 	ret = async_channel_register(vid, queue_id, ops);
@@ -36 +37 @@
- 	rte_rwlock_write_unlock(&vq->access_lock);
+ 	rte_spinlock_unlock(&vq->access_lock);
@@ -38 +39 @@
-@@ -1912,4 +1920,9 @@ rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
+@@ -1846,4 +1854,9 @@ rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
@@ -48 +49 @@
-@@ -1923,4 +1936,5 @@ rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
+@@ -1856,4 +1869,5 @@ rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
@@ -52 +53 @@
- 	rte_rwlock_write_unlock(&vq->access_lock);
+ 	rte_spinlock_unlock(&vq->access_lock);



More information about the stable mailing list