From: Yongseok Koh <yskoh@mellanox.com>
To: Tiwei Bie <tiwei.bie@intel.com>
Cc: "stable@dpdk.org" <stable@dpdk.org>,
"maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
"zhihong.wang@intel.com" <zhihong.wang@intel.com>
Subject: Re: [dpdk-stable] [PATCH 17.11] vhost: fix access for indirect descriptors
Date: Wed, 27 Mar 2019 18:32:24 +0000 [thread overview]
Message-ID: <44906910-6D2D-4E50-AD5D-A2FE17E6535F@mellanox.com> (raw)
In-Reply-To: <20190315092132.4106-1-tiwei.bie@intel.com>
> On Mar 15, 2019, at 2:21 AM, Tiwei Bie <tiwei.bie@intel.com> wrote:
>
> [ backported from upstream commit 48006390003b81f6d5c7b78e3f02ed49d1049945 ]
>
> Fix a possible out of bound access which may happen when handling
> indirect descs in split ring.
>
> Fixes: 1be4ebb1c464 ("vhost: support indirect descriptor in mergeable Rx")
>
> Reported-by: Haiyue Wang <haiyue.wang@intel.com>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
applied to stable/17.11
Thanks,
Yongseok
> lib/librte_vhost/virtio_net.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 3e2935992..07d4609ee 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -565,6 +565,7 @@ fill_vec_buf(struct virtio_net *dev, struct vhost_virtqueue *vq,
> uint16_t idx = vq->avail->ring[avail_idx & (vq->size - 1)];
> uint32_t vec_id = *vec_idx;
> uint32_t len = 0;
> + uint32_t nr_descs = vq->size;
> uint64_t dlen;
> struct vring_desc *descs = vq->desc;
> struct vring_desc *idesc = NULL;
> @@ -576,6 +577,7 @@ fill_vec_buf(struct virtio_net *dev, struct vhost_virtqueue *vq,
>
> if (vq->desc[idx].flags & VRING_DESC_F_INDIRECT) {
> dlen = vq->desc[idx].len;
> + nr_descs = dlen / sizeof(struct vring_desc);
> descs = (struct vring_desc *)(uintptr_t)
> vhost_iova_to_vva(dev, vq, vq->desc[idx].addr,
> &dlen,
> @@ -599,7 +601,7 @@ fill_vec_buf(struct virtio_net *dev, struct vhost_virtqueue *vq,
> }
>
> while (1) {
> - if (unlikely(vec_id >= BUF_VECTOR_MAX || idx >= vq->size)) {
> + if (unlikely(vec_id >= BUF_VECTOR_MAX || idx >= nr_descs)) {
> free_ind_table(idesc);
> return -1;
> }
> --
> 2.17.1
>
prev parent reply other threads:[~2019-03-27 18:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-15 9:21 Tiwei Bie
2019-03-27 18:32 ` Yongseok Koh [this message]
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=44906910-6D2D-4E50-AD5D-A2FE17E6535F@mellanox.com \
--to=yskoh@mellanox.com \
--cc=maxime.coquelin@redhat.com \
--cc=stable@dpdk.org \
--cc=tiwei.bie@intel.com \
--cc=zhihong.wang@intel.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).