From mboxrd@z Thu Jan 1 00:00:00 1970
From: Pavel Fedin
Subject: [PATCH] vhost_user: Make sure that memory map is set
before attempting address translation
Date: Tue, 12 Jan 2016 17:35:06 +0300
Message-ID: <1452609306-7724-1-git-send-email-p.fedin@samsung.com>
To: dev@dpdk.org
Return-path:
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 74F0B8E6E
for ; Tue, 12 Jan 2016 15:35:11 +0100 (CET)
Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245])
by mailout2.w1.samsung.com
(Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014))
with ESMTP id <0O0U00NJ7GIM4A20@mailout2.w1.samsung.com> for dev@dpdk.org;
Tue, 12 Jan 2016 14:35:10 +0000 (GMT)
List-Id: patches and discussions about DPDK
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: dev-bounces@dpdk.org
Sender: "dev"
Malfunctioning virtio clients may not send VHOST_USER_SET_MEM_TABLE for
some reason. This causes NULL dereference in qva_to_vva().
Change-Id: Ibc8f6637fb5fb9885b02c316adf18afd45e0d49a
Signed-off-by: Pavel Fedin
---
lib/librte_vhost/virtio-net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 0ba5045..3e7cec0 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -630,7 +630,7 @@ set_vring_addr(struct vhost_device_ctx ctx, struct vhost_vring_addr *addr)
struct vhost_virtqueue *vq;
dev = get_device(ctx);
- if (dev == NULL)
+ if ((dev == NULL) || (dev->mem == NULL))
return -1;
/* addr->index refers to the queue index. The txq 1, rxq is 0. */
--
2.1.1