patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Marvin Liu <>
Cc:, Marvin Liu <>,
Subject: [dpdk-stable] [PATCH 1/3] vhost: fix split ring potential buffer overflow
Date: Thu, 25 Mar 2021 11:01:37 +0800
Message-ID: <> (raw)
In-Reply-To: <>

In vhost datapath, descriptor's length are mostly used in two coherent
operations. First step is used for address translation, second step is
used for memory transaction from guest to host. But the iterval between
two steps will give a window for malicious guest, in which can change
descriptor length after vhost calcuated buffer size. Thus may lead to
buffer overflow in vhost side. This potential risk can be eliminated by
accessing the descriptor length once.

Fixes: 1be4ebb1c464 ("vhost: support indirect descriptor in mergeable Rx")

Signed-off-by: Marvin Liu <>
Reviewed-by: Maxime Coquelin <>

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 583bf379c6..576a0a20c0 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -548,10 +548,11 @@ fill_vec_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 			return -1;
-		len += descs[idx].len;
+		dlen = descs[idx].len;
+		len += dlen;
 		if (unlikely(map_one_desc(dev, vq, buf_vec, &vec_id,
-						descs[idx].addr, descs[idx].len,
+						descs[idx].addr, dlen,
 						perm))) {
 			return -1;

  parent reply	other threads:[~2021-03-25  3:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26  7:33 [dpdk-stable] [PATCH] vhost: fix " Marvin Liu
2021-03-24  8:55 ` Maxime Coquelin
2021-03-25  3:08   ` Liu, Yong
2021-03-25  3:01 ` Marvin Liu [this message]
2021-03-25  3:01   ` [dpdk-stable] [PATCH 2/3] vhost: fix packed ring " Marvin Liu
2021-03-25  3:01   ` [dpdk-stable] [PATCH 3/3] vhost: fix potential buffer overflow when batch dequeue Marvin Liu
2021-03-31  6:49 [dpdk-stable] [PATCH 1/3] vhost: fix split ring potential buffer overflow Marvin Liu
2021-03-31  7:48 ` Xia, Chenbo

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:

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

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ \
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone