patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Li Feng <fengli@smartx.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>, Lin Li <lilin24@baidu.com>,
	Jin Yu <jin.yu@intel.com>, Yu Zhang <zhangyu31@baidu.com>,
	Xun Ni <nixun@baidu.com>
Cc: dev@dpdk.org, Li Feng <fengli@smartx.com>, stable@dpdk.org
Subject: [dpdk-stable] [PATCH v2] vhost: add sanity check when operating the split ring
Date: Thu, 14 Oct 2021 20:40:08 +0800	[thread overview]
Message-ID: <20211014124008.3570044-1-fengli@smartx.com> (raw)
In-Reply-To: <20210827051241.2448098-1-fengli@smartx.com>

The idx in rte_vhost_set_last_inflight_io_split is from the frontend
driver, check if it's in the virtqueue range.

Fixes: bb0c2de9602b ("vhost: add APIs to operate inflight ring")
Cc: stable@dpdk.org

Signed-off-by: Li Feng <fengli@smartx.com>
---
 lib/vhost/vhost.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
index 9540522dac..3b674ac320 100644
--- a/lib/vhost/vhost.c
+++ b/lib/vhost/vhost.c
@@ -1226,6 +1226,9 @@ rte_vhost_set_last_inflight_io_split(int vid, uint16_t vring_idx,
 	if (unlikely(!vq->inflight_split))
 		return -1;
 
+	if (unlikely(idx >= vq->size))
+		return -1;
+
 	vq->inflight_split->last_inflight_io = idx;
 	return 0;
 }
-- 
2.31.1


       reply	other threads:[~2021-10-14 12:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210827051241.2448098-1-fengli@smartx.com>
2021-10-14 12:40 ` Li Feng [this message]
2021-10-15  8:51   ` [dpdk-stable] [dpdk-dev] " Maxime Coquelin
2021-10-15  9:25     ` Li Feng
2021-10-21 12:32       ` Maxime Coquelin

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=20211014124008.3570044-1-fengli@smartx.com \
    --to=fengli@smartx.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=jin.yu@intel.com \
    --cc=lilin24@baidu.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nixun@baidu.com \
    --cc=stable@dpdk.org \
    --cc=zhangyu31@baidu.com \
    /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).