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: <20140715091911.GA19104@devel.8.8.4.4>
Date:	Tue, 15 Jul 2014 18:19:11 +0900
From:	Daeseok Youn <daeseok.youn@...il.com>
To:	lidza.louina@...il.com, markh@...pro.net
Cc:	markh@...pro.net, daeseok.youn@...il.com,
	gregkh@...uxfoundation.org, driverdev-devel@...uxdriverproject.org,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH 8/8 V2] staging: dgap: fix memory leak in dgap_parsefile()

The p->u.board.status is allocated and set a string as
"No" once within allocating a node of BNODE type.
But it also set again with kstrdup() in case of "STATUS"
or "ID". So just free this buffer and allocate again with
kstrdup().

Signed-off-by: Daeseok Youn <daeseok.youn@...il.com>
---
V2: just use kfree for buffers which assigned to newly value
    and then allocate again properly.

 drivers/staging/dgap/dgap.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index e4ea68b..76503fe 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -6599,6 +6599,8 @@ static int dgap_parsefile(char **in)
 				pr_err("parse: unexpected end of file\n");
 				return -1;
 			}
+
+			kfree(p->u.board.status);
 			p->u.board.status = kstrdup(s, GFP_KERNEL);
 			break;
 
@@ -6649,6 +6651,7 @@ static int dgap_parsefile(char **in)
 				return -1;
 			}
 
+			kfree(p->u.board.status);
 			p->u.board.status = kstrdup(s, GFP_KERNEL);
 
 			if (p->type == CNODE) {
-- 
1.7.1

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