* [PATCH] vhost: fix queue number check when setting inflight FD
@ 2022-02-16 1:53 Chenbo Xia
2022-02-16 2:18 ` Xia, Chenbo
0 siblings, 1 reply; 2+ messages in thread
From: Chenbo Xia @ 2022-02-16 1:53 UTC (permalink / raw)
To: chenbo.xia; +Cc: stable
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] vhost: fix queue number check when setting inflight FD
2022-02-16 1:53 [PATCH] vhost: fix queue number check when setting inflight FD Chenbo Xia
@ 2022-02-16 2:18 ` Xia, Chenbo
0 siblings, 0 replies; 2+ messages in thread
From: Xia, Chenbo @ 2022-02-16 2:18 UTC (permalink / raw)
To: stable
It's mistake.. please ignore the patch. Sorry for the noise
> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Wednesday, February 16, 2022 9:53 AM
> To: Xia, Chenbo <chenbo.xia@intel.com>
> Cc: stable@dpdk.org
> Subject: [PATCH] vhost: fix queue number check when setting inflight FD
>
> 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.
>
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-16 2:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 1:53 [PATCH] vhost: fix queue number check when setting inflight FD Chenbo Xia
2022-02-16 2:18 ` Xia, Chenbo
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).