summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorInsu Yun <wuninsu@gmail.com>2016-01-18 11:54:43 -0500
committerDavid Vrabel <david.vrabel@citrix.com>2016-02-15 13:56:57 +0000
commit85c0a87cd117e83361932b2b160c9af178fdb21a (patch)
tree3f29931c9be46cb4ed83c1bf75cf05b85293e2fd
parent52ba0746b3b44c86aee121babf3b2fd9b8f84090 (diff)
downloadlinux-stable-85c0a87cd117e83361932b2b160c9af178fdb21a.tar.gz
linux-stable-85c0a87cd117e83361932b2b160c9af178fdb21a.tar.bz2
linux-stable-85c0a87cd117e83361932b2b160c9af178fdb21a.zip
xen: fix potential integer overflow in queue_reply
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. Signed-off-by: Insu Yun <wuninsu@gmail.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
-rw-r--r--drivers/xen/xenbus/xenbus_dev_frontend.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index 9433e46518c8..912b64edb42b 100644
--- a/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -188,6 +188,8 @@ static int queue_reply(struct list_head *queue, const void *data, size_t len)
if (len == 0)
return 0;
+ if (len > XENSTORE_PAYLOAD_MAX)
+ return -EINVAL;
rb = kmalloc(sizeof(*rb) + len, GFP_KERNEL);
if (rb == NULL)