From: Pavel Fedin Date: Wed, 13 Jan 2016 07:32:57 +0000 (+0300) Subject: vhost: check memory map before address translation X-Git-Tag: spdx-start~7605 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2f29ce885a999549324c4189796a0688e0c9b653;p=dpdk.git vhost: check memory map before address translation 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 --- diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index e189c74375..fe1a77e80b 100644 --- a/lib/librte_vhost/virtio-net.c +++ b/lib/librte_vhost/virtio-net.c @@ -632,7 +632,7 @@ vhost_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. */