From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Qiu Subject: [PATCH] vhost: Fix Segmentation fault of NULL address Date: Thu, 26 Mar 2015 15:04:56 +0800 Message-ID: <1427353496-21965-1-git-send-email-michael.qiu@intel.com> To: dev-VfR2kkLFssw@public.gmane.org Return-path: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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 --- 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