From mboxrd@z Thu Jan 1 00:00:00 1970
From: Pavel Fedin
Subject: [RESEND PATCH] vhost_user: Make sure that memory map is
set before attempting address translation
Date: Wed, 13 Jan 2016 10:32:57 +0300
Message-ID: <005a01d14dd4$a02c5340$e084f9c0$@samsung.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: dev@dpdk.org
Return-path:
Received: from mailout3.w1.samsung.com (mailout3.w1.samsung.com
[210.118.77.13]) by dpdk.org (Postfix) with ESMTP id 753C6370
for ; Wed, 13 Jan 2016 08:33:00 +0100 (CET)
Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245])
by mailout3.w1.samsung.com
(Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014))
with ESMTP id <0O0V00GTKRMZA310@mailout3.w1.samsung.com> for dev@dpdk.org;
Wed, 13 Jan 2016 07:32:59 +0000 (GMT)
Content-language: ru
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().
Signed-off-by: Pavel Fedin
Acked-by: Yuanhan Liu
---
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