Thread (16 messages) 16 messages, 4 authors, 2019-11-06

[dpdk-dev] [PATCH] vhost: fix vhost user virtqueue not accessable

From: Marvin Liu <hidden>
Date: 2019-10-25 08:40:57
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

Log feature is disabled in vhost user, so that log address was invalid
when checking. Add feature bit check can skip useless address check.

Fixes: 04cfc7fdbfca ("vhost: translate incoming log address to gpa")

Signed-off-by: Marvin Liu <redacted>
---
 lib/librte_vhost/vhost_user.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 61ef699ac..0407fdc29 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -741,13 +741,15 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index)
 		vq->last_avail_idx = vq->used->idx;
 	}
 
-	vq->log_guest_addr =
-		translate_log_addr(dev, vq, addr->log_guest_addr);
-	if (vq->log_guest_addr == 0) {
-		RTE_LOG(DEBUG, VHOST_CONFIG,
-			"(%d) failed to map log_guest_addr .\n",
-			dev->vid);
-		return dev;
+	if (dev->features & (1ULL << VHOST_F_LOG_ALL)) {
+		vq->log_guest_addr =
+			translate_log_addr(dev, vq, addr->log_guest_addr);
+		if (vq->log_guest_addr == 0) {
+			RTE_LOG(DEBUG, VHOST_CONFIG,
+				"(%d) failed to map log_guest_addr .\n",
+				dev->vid);
+			return dev;
+		}
 	}
 	vq->access_ok = 1;
 
-- 
2.17.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help