From: David Vrabel <david.vrabel@citrix.com>
To: David Vrabel <david.vrabel@citrix.com>,
Insu Yun <wuninsu@gmail.com>, <konrad.wilk@oracle.com>,
<boris.ostrovsky@oracle.com>, <Jennifer.Herbert@citrix.com>,
<xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org>
Cc: <yeongjin.jang@gatech.edu>, <taesoo@gatech.edu>,
<insu@gatech.edu>, <changwoo@gatech.edu>
Subject: Re: [Xen-devel] [PATCH] xen: fix potential integer overflow in queue_reply
Date: Mon, 18 Jan 2016 16:47:15 +0000 [thread overview]
Message-ID: <569D1713.3060306@citrix.com> (raw)
In-Reply-To: <569D14E9.2050300@citrix.com>
On 18/01/16 16:38, David Vrabel wrote:
> On 18/01/16 16:29, Insu Yun wrote:
>> When len is greater than UINT_MAX - sizeof(*rb), in next allocation,
>> it can overflow integer range and allocates small size of heap.
>> After that, memcpy will overflow the allocated heap.
>> Therefore, it needs to check the size of given length.
> [...]
>> --- a/drivers/xen/xenbus/xenbus_dev_frontend.c
>> +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
>> @@ -186,7 +186,7 @@ static int queue_reply(struct list_head *queue, const void *data, size_t len)
>> {
>> struct read_buffer *rb;
>>
>> - if (len == 0)
>> + if (len == 0 || len >= UINT_MAX - sizeof(*rb))
> ^^^^^^^^^^^^^^^^^^^^^^
> Please check
>
> len > XENSTORE_PAYLOAD_MAX
>
> instead.
And return -EINVAL in this case (not zero).
David
prev parent reply other threads:[~2016-01-18 16:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 16:29 Insu Yun
2016-01-18 16:38 ` David Vrabel
2016-01-18 16:47 ` David Vrabel [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=569D1713.3060306@citrix.com \
--to=david.vrabel@citrix.com \
--cc=Jennifer.Herbert@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=changwoo@gatech.edu \
--cc=insu@gatech.edu \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=taesoo@gatech.edu \
--cc=wuninsu@gmail.com \
--cc=xen-devel@lists.xenproject.org \
--cc=yeongjin.jang@gatech.edu \
/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
Powered by JetHome