lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 21 Feb 2007 14:21:22 +0200 (EET)
From:	Pekka J Enberg <penberg@...helsinki.fi>
To:	akpm@...ux-foundation.org
cc:	jsipek@....cs.sunysb.edu, linux-kernel@...r.kernel.org
Subject: [PATCH] unionfs: fix memory leak when calling krealloc

From: Pekka Enberg <penberg@...helsinki.fi>

We must not overwrite the same pointer that is passed to krealloc() 
because it can return NULL without freeing the buffer.  Fixes a memory 
leak introduced by me.

Cc: Josef Sipek <jsipek@....cs.sunysb.edu>
Signed-off-by: Pekka Enberg <penberg@...helsinki.fi>
---
 fs/unionfs/copyup.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Index: 2.6/fs/unionfs/copyup.c
===================================================================
--- 2.6.orig/fs/unionfs/copyup.c	2007-02-21 14:15:30.000000000 +0200
+++ 2.6/fs/unionfs/copyup.c	2007-02-21 14:16:19.000000000 +0200
@@ -658,11 +658,14 @@
 
 		/* grow path table */
 		if (count == num_dentry) {
-			path = krealloc(path, kmalloc_size * 2, GFP_KERNEL);
-			if (!path) {
+			void *p;
+
+			p = krealloc(path, kmalloc_size * 2, GFP_KERNEL);
+			if (!p) {
 				hidden_dentry = ERR_PTR(-ENOMEM);
 				goto out;
 			}
+			path = p;
 			kmalloc_size = ksize(path);
 			num_dentry = kmalloc_size / sizeof(struct dentry *);
 		}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ