From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, Jason Wang <jasowang@redhat.com>
Subject: [PATCH RFC v4 5/5] vhost: last descriptor must have NEXT clear
Date: Sun, 13 Oct 2019 07:42:22 -0400 [thread overview]
Message-ID: <20191013113940.2863-6-mst@redhat.com> (raw)
In-Reply-To: <20191013113940.2863-1-mst@redhat.com>
fetch_buf already guarantees we exit on a descriptor without a NEXT
flag. Add a BUG_ON statement to make sure we don't overflow the buffer
in case of a bug.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/vhost/vhost.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index d46c28149f6f..09f594bb069a 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -2656,6 +2656,8 @@ int vhost_get_vq_desc_batch(struct vhost_virtqueue *vq,
break;
}
+ BUG_ON(i >= vq->ndescs);
+
vq->first_desc = i + 1;
return ret;
--
MST
next prev parent reply other threads:[~2019-10-13 11:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-13 11:41 [PATCH RFC v4 0/5] vhost: ring format independence Michael S. Tsirkin
2019-10-13 11:42 ` [PATCH RFC v4 1/5] vhost: option to fetch descriptors through an independent struct Michael S. Tsirkin
2019-10-13 11:42 ` [PATCH RFC v4 2/5] vhost/test: add an option to test new code Michael S. Tsirkin
2019-10-13 11:42 ` [PATCH RFC v4 3/5] vhost: batching fetches Michael S. Tsirkin
2019-10-13 11:42 ` [PATCH RFC v4 4/5] vhost/net: add an option to test new code Michael S. Tsirkin
2019-10-13 11:42 ` Michael S. Tsirkin [this message]
2019-10-15 2:58 ` [PATCH RFC v4 0/5] vhost: ring format independence Jason Wang
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=20191013113940.2863-6-mst@redhat.com \
--to=mst@redhat.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.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).