DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavel Fedin <p.fedin@samsung.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] vhost_user: Make sure that memory map is set before attempting address translation
Date: Tue, 12 Jan 2016 17:35:06 +0300	[thread overview]
Message-ID: <1452609306-7724-1-git-send-email-p.fedin@samsung.com> (raw)

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 <p.fedin@samsung.com>
---
 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

             reply	other threads:[~2016-01-12 14:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 14:35 Pavel Fedin [this message]
2016-01-13  1:38 ` Yuanhan Liu
2016-01-13  7:18   ` Pavel Fedin
2016-01-13  7:24     ` Yuanhan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452609306-7724-1-git-send-email-p.fedin@samsung.com \
    --to=p.fedin@samsung.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).