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]
Message-Id: <200708042032.05139.jesper.juhl@gmail.com>
Date:	Sat, 4 Aug 2007 20:32:04 +0200
From:	Jesper Juhl <jesper.juhl@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Thomas Hood <dthood@...l.com>,
	David Hinds <dahinds@...rs.sourceforge.net>,
	Jesper Juhl <jesper.juhl@...il.com>
Subject: [PATCH][RESEND][pnp] Avoid a small unlikely memory leak in proc_read_escd()

(Resending patch originally submitted on 20/7-2007 23:41)


Hi,

There's a small and unlikely memory leak in 
drivers/pnp/pnpbios/proc.c::proc_read_escd(). It's inside a sanity 
check, so it probably won't trigger often (if at all), however it 
*is* a potential leak and it's easy to avoid, so let's just fix it :)

While I was in there I also broke a oneline 'if' statement into two 
lines - seemed too trivial a changee to warrent a seperate patch.


Signed-off-by: Jesper Juhl <jesper.juhl@...il.com>
---

 drivers/pnp/pnpbios/proc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
index 8027073..f77b8c4 100644
--- a/drivers/pnp/pnpbios/proc.c
+++ b/drivers/pnp/pnpbios/proc.c
@@ -88,7 +88,8 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
 	}
 
 	tmpbuf = kzalloc(escd.escd_size, GFP_KERNEL);
-	if (!tmpbuf) return -ENOMEM;
+	if (!tmpbuf)
+		return -ENOMEM;
 
 	if (pnp_bios_read_escd(tmpbuf, escd.nv_storage_base)) {
 		kfree(tmpbuf);
@@ -100,6 +101,7 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
 	/* sanity check */
 	if (escd_size > MAX_SANE_ESCD_SIZE) {
 		printk(KERN_ERR "PnPBIOS: proc_read_escd: ESCD size reported by BIOS read_escd call is too great\n");
+		kfree(tmpbuf);
 		return -EFBIG;
 	}
 


-
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