diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2011-11-04 14:24:08 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-11-16 12:13:47 -0500 |
commit | 21643e69a4c06f7ef155fbc70e3fba13fba4a756 (patch) | |
tree | 8ab4fce440977edd5508abed992022674dec9d77 /drivers/xen | |
parent | fc6e0c3b909157748ce1c0c0f2a9935a5ee3c812 (diff) |
xen-gntalloc: integer overflow in gntalloc_ioctl_alloc()
On 32 bit systems a high value of op.count could lead to an integer
overflow in the kzalloc() and gref_ids would be smaller than
expected. If the you triggered another integer overflow in
"if (gref_size + op.count > limit)" then you'd probably get memory
corruption inside add_grefs().
CC: stable@kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/gntalloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c index f6832f46aea..23c60cf4313 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c | |||
@@ -280,7 +280,7 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv, | |||
280 | goto out; | 280 | goto out; |
281 | } | 281 | } |
282 | 282 | ||
283 | gref_ids = kzalloc(sizeof(gref_ids[0]) * op.count, GFP_TEMPORARY); | 283 | gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_TEMPORARY); |
284 | if (!gref_ids) { | 284 | if (!gref_ids) { |
285 | rc = -ENOMEM; | 285 | rc = -ENOMEM; |
286 | goto out; | 286 | goto out; |