Skip to content

Commit 2f29ce8

Browse files
pfedinThomas Monjalon
authored andcommitted
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 <p.fedin@samsung.com> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
1 parent a90ca1a commit 2f29ce8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/librte_vhost/virtio-net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ vhost_set_vring_addr(struct vhost_device_ctx ctx, struct vhost_vring_addr *addr)
632632
struct vhost_virtqueue *vq;
633633

634634
dev = get_device(ctx);
635-
if (dev == NULL)
635+
if ((dev == NULL) || (dev->mem == NULL))
636636
return -1;
637637

638638
/* addr->index refers to the queue index. The txq 1, rxq is 0. */

0 commit comments

Comments
 (0)