From: Insu Yun Date: Mon, 18 Jan 2016 16:54:43 +0000 (-0500) Subject: xen: fix potential integer overflow in queue_reply X-Git-Tag: v4.5-rc6~34^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=85c0a87cd117e83361932b2b160c9af178fdb21a;p=platform%2Fkernel%2Flinux-exynos.git 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 Signed-off-by: David Vrabel --- diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 9433e46..912b64e 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)