* [patch 1/2] xen-gntalloc: integer overflow in gntalloc_ioctl_alloc()
@ 2011-11-04 18:24 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2011-11-04 18:24 UTC (permalink / raw)
To: Jeremy Fitzhardinge
Cc: kernel-janitors, xen-devel, virtualization, Konrad Rzeszutek Wilk
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().
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c
index f6832f4..23c60cf 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,
goto out;
}
- gref_ids = kzalloc(sizeof(gref_ids[0]) * op.count, GFP_TEMPORARY);
+ gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_TEMPORARY);
if (!gref_ids) {
rc = -ENOMEM;
goto out;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch 1/2] xen-gntalloc: integer overflow in gntalloc_ioctl_alloc()
[not found] <20111104182408.GD5796@elgon.mountain>
@ 2011-11-04 18:35 ` Konrad Rzeszutek Wilk
0 siblings, 0 replies; 2+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-11-04 18:35 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jeremy Fitzhardinge, kernel-janitors, xen-devel, virtualization
On Fri, Nov 04, 2011 at 09:24:08PM +0300, Dan Carpenter wrote:
> 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().
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Great! Keep them coming! Will push for stable and 3.2.
>
> diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c
> index f6832f4..23c60cf 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,
> goto out;
> }
>
> - gref_ids = kzalloc(sizeof(gref_ids[0]) * op.count, GFP_TEMPORARY);
> + gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_TEMPORARY);
> if (!gref_ids) {
> rc = -ENOMEM;
> goto out;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-04 18:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20111104182408.GD5796@elgon.mountain>
2011-11-04 18:35 ` [patch 1/2] xen-gntalloc: integer overflow in gntalloc_ioctl_alloc() Konrad Rzeszutek Wilk
2011-11-04 18:24 Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).