All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix leak in blkback initialization
@ 2006-01-04 15:15 Glauber de Oliveira Costa
  2006-01-05 14:06 ` Vincent Hanquez
  0 siblings, 1 reply; 3+ messages in thread
From: Glauber de Oliveira Costa @ 2006-01-04 15:15 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

In case of failing due to lack of memory in the system, blkif_init
potentially leaves a leak if some of the allocations was sucessfully
suceeded.

This patch frees the memory allocated, avoiding the leak.

Signed-off-by: Glauber de Oliveira Costa <glommer@br.ibm.com>
-- 
glommer

[-- Attachment #2: blkback-leak --]
[-- Type: text/plain, Size: 993 bytes --]

# HG changeset patch
# User root@kct
# Node ID 0b7920d3ca98c3c011b2756afcffb7e2c31b7d2d
# Parent  8f6d4878d02e65438dabda642d7bf84679dbd464

In case of failing due to lack of memory in the system, blkif_init
potentially leaves a leak if some of the allocations was sucessfully
suceeded. 

This patch frees the memory allocated, avoiding the leak. 

Signed-off-by: Glauber de Oliveira Costa <glommer@br.ibm.com>

diff -r 8f6d4878d02e -r 0b7920d3ca98 linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Tue Jan  3 19:01:55 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Wed Jan  4 13:55:33 2006
@@ -540,6 +540,9 @@
 	pending_vaddrs        = kmalloc(sizeof(pending_vaddrs[0]) *
 					mmap_pages, GFP_KERNEL);
 	if (!pending_reqs || !pending_grant_handles || !pending_vaddrs) {
+		kfree(pending_reqs);
+		kfree(pending_grant_handles);
+		kfree(pending_vaddrs);
 		printk("%s: out of memory\n", __FUNCTION__);
 		return -1;
 	}

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix leak in blkback initialization
  2006-01-04 15:15 [PATCH] Fix leak in blkback initialization Glauber de Oliveira Costa
@ 2006-01-05 14:06 ` Vincent Hanquez
  2006-01-05 14:33   ` Glauber de Oliveira Costa
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Hanquez @ 2006-01-05 14:06 UTC (permalink / raw)
  To: Glauber de Oliveira Costa; +Cc: xen-devel

On Wed, Jan 04, 2006 at 03:15:06PM +0000, Glauber de Oliveira Costa wrote:
> In case of failing due to lack of memory in the system, blkif_init
> potentially leaves a leak if some of the allocations was sucessfully
> suceeded.
> 
> This patch frees the memory allocated, avoiding the leak.

This has already been corrected (changeset 8469)

Thanks,
-- 
Vincent Hanquez

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix leak in blkback initialization
  2006-01-05 14:06 ` Vincent Hanquez
@ 2006-01-05 14:33   ` Glauber de Oliveira Costa
  0 siblings, 0 replies; 3+ messages in thread
From: Glauber de Oliveira Costa @ 2006-01-05 14:33 UTC (permalink / raw)
  To: Vincent Hanquez; +Cc: xen-devel, Glauber de Oliveira Costa

Yes, I saw that. It just happened to me to see the error a little bit
before seeing the correction =]

Thanks,

glommer.

On 1/5/06, Vincent Hanquez <vincent.hanquez@cl.cam.ac.uk> wrote:
> On Wed, Jan 04, 2006 at 03:15:06PM +0000, Glauber de Oliveira Costa wrote:
> > In case of failing due to lack of memory in the system, blkif_init
> > potentially leaves a leak if some of the allocations was sucessfully
> > suceeded.
> >
> > This patch frees the memory allocated, avoiding the leak.
>
> This has already been corrected (changeset 8469)
>
> Thanks,
> --
> Vincent Hanquez
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>


--
Free Software : Technology for a better world
=============================
Glauber de Oliveira Costa
jabber: glommer@jabber.org
=============================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-01-05 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-04 15:15 [PATCH] Fix leak in blkback initialization Glauber de Oliveira Costa
2006-01-05 14:06 ` Vincent Hanquez
2006-01-05 14:33   ` Glauber de Oliveira Costa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.