All of lore.kernel.org
 help / color / mirror / Atom feed
From: glommer@br.ibm.com (Glauber de Oliveira Costa)
To: xen-devel@lists.xensource.com
Subject: [PATCH] Fix leak in blkback initialization
Date: Wed, 4 Jan 2006 15:15:06 +0000	[thread overview]
Message-ID: <20060104151506.GA26795@br.ibm.com> (raw)

[-- 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

             reply	other threads:[~2006-01-04 15:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-04 15:15 Glauber de Oliveira Costa [this message]
2006-01-05 14:06 ` [PATCH] Fix leak in blkback initialization Vincent Hanquez
2006-01-05 14:33   ` Glauber de Oliveira Costa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060104151506.GA26795@br.ibm.com \
    --to=glommer@br.ibm.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.