From: "Matej Mužila" <mmuzila@redhat.com>
To: kys@microsoft.com, devel@linuxdriverproject.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] tools: hv: fcopy_daemon: Check buffer limits
Date: Tue, 21 Oct 2014 13:49:00 +0200 [thread overview]
Message-ID: <5446482C.1000003@redhat.com> (raw)
From: Matej Mužila <mmuzila@redhat.com>
Check if cpmsg->size is in limits of DATA_FRAGMENT
Signed-off-by: Matej Mužila <mmuzila@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
---
If corrupted data are read from /dev/vmbus/hv_fcopy, pwrite can
read from memory outside of the buffer (defined at line 138).
Added check.
---
@@ -104,6 +104,10 @@ static int hv_copy_data(struct hv_do_fcopy *cpmsg)
{
ssize_t bytes_written;
+ // Check if the cpmsg->size is in limits of DATA_FRAGMENT
+ if (cpmsg->size > DATA_FRAGMENT * sizeof(__u8))
+ return HV_E_FAIL;
+
bytes_written = pwrite(target_fd, cpmsg->data, cpmsg->size,
cpmsg->offset);
next reply other threads:[~2014-10-21 11:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 11:49 Matej Mužila [this message]
2014-10-21 12:13 ` [PATCH 1/3] tools: hv: fcopy_daemon: Check buffer limits One Thousand Gnomes
2014-10-21 12:59 ` Matej Mužila
2014-10-21 14:17 ` Dan Carpenter
2014-10-21 14:46 ` [PATCH v2 " Matej Mužila
2014-11-07 18:19 ` Greg KH
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=5446482C.1000003@redhat.com \
--to=mmuzila@redhat.com \
--cc=devel@linuxdriverproject.org \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.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).