[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1453134547-13875-1-git-send-email-wuninsu@gmail.com>
Date: Mon, 18 Jan 2016 11:29:07 -0500
From: Insu Yun <wuninsu@...il.com>
To: konrad.wilk@...cle.com, boris.ostrovsky@...cle.com,
david.vrabel@...rix.com, Jennifer.Herbert@...rix.com,
xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org
Cc: taesoo@...ech.edu, yeongjin.jang@...ech.edu, insu@...ech.edu,
changwoo@...ech.edu, Insu Yun <wuninsu@...il.com>
Subject: [PATCH] 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@...il.com>
---
drivers/xen/xenbus/xenbus_dev_frontend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index 9433e46..b45ed69 100644
--- 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))
return 0;
rb = kmalloc(sizeof(*rb) + len, GFP_KERNEL);
--
1.9.1
Powered by blists - more mailing lists