[dpdk-dev] [PATCH] vhost: Fix Segmentation fault of NULL address

Michael Qiu michael.qiu at intel.com
Thu Mar 26 08:04:56 CET 2015


Function gpa_to_vva() could return zero, while this will lead
a Segmentation fault.

This patch is to fix this issue.

Signed-off-by: Michael Qiu <michael.qiu at intel.com>
---
 lib/librte_vhost/vhost_rxtx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index 535c7a1..23c8acb 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -587,6 +587,9 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id,
 
 		/* Buffer address translation. */
 		vb_addr = gpa_to_vva(dev, desc->addr);
+		if (!vb_addr)
+			return entry_success;
+
 		/* Prefetch buffer address. */
 		rte_prefetch0((void *)(uintptr_t)vb_addr);
 
-- 
1.9.3



More information about the dev mailing list