From: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
To: yliu@fridaylinux.org
Cc: dev@dpdk.org, Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>,
jianfeng.tan@intel.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v3] net/virtio: fix of untrusted scalar value
Date: Fri, 22 Sep 2017 17:21:49 +0200 [thread overview]
Message-ID: <20170922152149.16876-1-danielx.t.mrzyglod@intel.com> (raw)
In-Reply-To: <20170920132556.5310-1-danielx.t.mrzyglod@intel.com>
The unscrutinized value may be incorrectly assumed to be within a certain
range by later operations.
In vhost_user_read: An unscrutinized value from an untrusted source used
in a trusted context - the value of sz_payload may be harmfull and we need
limit them to the max value of payload.
Coverity issue: 139601
Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
Cc: jianfeng.tan@intel.com
Cc: stable@dpdk.org
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
v3:
* there were wrong v2 email adress for stable dpdk mailinglist
* fix compilation errors
v2:
* Add Cc for stable in gitlog massage
* Add Coverity line
* v1 was acked by Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
drivers/net/virtio/virtio_user/vhost_user.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index 4ad7b21..97bd832 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -130,6 +130,10 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
}
sz_payload = msg->size;
+
+ if ((size_t)sz_payload > sizeof(msg->payload))
+ goto fail;
+
if (sz_payload) {
ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
if (ret < sz_payload) {
--
2.7.4
next prev parent reply other threads:[~2017-09-22 15:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 9:19 [dpdk-dev] [PATCH] " Daniel Mrzyglod
2017-09-20 9:31 ` Mrzyglod, DanielX T
2017-09-20 9:38 ` Tan, Jianfeng
2017-09-20 13:25 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
2017-09-22 15:21 ` Daniel Mrzyglod [this message]
2017-09-27 9:25 ` [dpdk-dev] [PATCH v3] " Yuanhan Liu
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=20170922152149.16876-1-danielx.t.mrzyglod@intel.com \
--to=danielx.t.mrzyglod@intel.com \
--cc=dev@dpdk.org \
--cc=jianfeng.tan@intel.com \
--cc=stable@dpdk.org \
--cc=yliu@fridaylinux.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).