[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <569D1713.3060306@citrix.com>
Date: Mon, 18 Jan 2016 16:47:15 +0000
From: David Vrabel <david.vrabel@...rix.com>
To: David Vrabel <david.vrabel@...rix.com>,
Insu Yun <wuninsu@...il.com>, <konrad.wilk@...cle.com>,
<boris.ostrovsky@...cle.com>, <Jennifer.Herbert@...rix.com>,
<xen-devel@...ts.xenproject.org>, <linux-kernel@...r.kernel.org>
CC: <yeongjin.jang@...ech.edu>, <taesoo@...ech.edu>, <insu@...ech.edu>,
<changwoo@...ech.edu>
Subject: Re: [Xen-devel] [PATCH] xen: fix potential integer overflow in queue_reply
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
Powered by blists - more mailing lists