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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1437118263-14342-1-git-send-email-christophe.jaillet@wanadoo.fr>
Date:	Fri, 17 Jul 2015 09:31:03 +0200
From:	Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:	tony.luck@...el.com, fenghua.yu@...el.com
Cc:	linux-ia64@...r.kernel.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org,
	Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH] ia64: sn2: Add missing kfree in error path

If 'ia64_sn_hwperf_op' fails, then 'ptdata' should be freed, otherwise,
there is a memory leak.

Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
This patch is *untested* because I have no way to trigger the error.
---
 arch/ia64/sn/kernel/sn2/sn_hwperf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index b999257..9e1694f 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -499,8 +499,10 @@ static int sn_topology_show(struct seq_file *s, void *d)
 		e = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
 				      SN_HWPERF_ENUM_PORTS, obj->id, sz,
 				      (u64) ptdata, 0, 0, NULL);
-		if (e != SN_HWPERF_OP_OK)
+		if (e != SN_HWPERF_OP_OK) {
+			kfree(ptdata);
 			return -EINVAL;
+		}
 		for (ordinal=0, p=objs; p != obj; p++) {
 			if (!SN_HWPERF_FOREIGN(p))
 				ordinal += p->ports;
-- 
2.1.4

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