Skip to content

Commit 21643e6

Browse files
Dan Carpenterkonradwilk
authored andcommitted
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>
1 parent fc6e0c3 commit 21643e6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/xen/gntalloc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv,
280280
goto out;
281281
}
282282

283-
gref_ids = kzalloc(sizeof(gref_ids[0]) * op.count, GFP_TEMPORARY);
283+
gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_TEMPORARY);
284284
if (!gref_ids) {
285285
rc = -ENOMEM;
286286
goto out;

0 commit comments

Comments
 (0)