From: Chenbo Xia <chenbo.xia@intel.com>
To: chenbo.xia@intel.com
Cc: stable@dpdk.org
Subject: [PATCH] vhost: fix queue number check when setting inflight FD
Date: Wed, 16 Feb 2022 09:53:13 +0800 [thread overview]
Message-ID: <20220216015313.15615-1-chenbo.xia@intel.com> (raw)
In function vhost_user_set_inflight_fd, queue number in inflight
message is used to access virtqueue. However, queue number could
be larger than VHOST_MAX_VRING and cause write OOB as this number
will be used to write inflight info in virtqueue structure. This
patch checks the queue number to avoid the issue.
CVE-2021-3839
Fixes: ad0a4ae491fe ("vhost: checkout resubmit inflight information")
Cc: stable@dpdk.org
Reported-by: Wenxiang Qian <leonwxqian@gmail.com>
Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
---
lib/vhost/vhost_user.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 1d3f89afd8..b20addd125 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -1718,6 +1718,12 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev,
num_queues = ctx->msg.payload.inflight.num_queues;
queue_size = ctx->msg.payload.inflight.queue_size;
+ if (num_queues > VHOST_MAX_VRING) {
+ VHOST_LOG_CONFIG(ERR, "(%s) invalid inflight queue num: %u\n",
+ dev->ifname, num_queues);
+ return RTE_VHOST_MSG_RESULT_ERR;
+ }
+
if (vq_is_packed(dev))
pervq_inflight_size = get_pervq_shm_size_packed(queue_size);
else
--
2.17.1
next reply other threads:[~2022-02-16 2:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 1:53 Chenbo Xia [this message]
2022-02-16 2:18 ` 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:
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=20220216015313.15615-1-chenbo.xia@intel.com \
--to=chenbo.xia@intel.com \
--cc=stable@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).