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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 6 Dec 2013 14:23:42 +0800
From:	Wang Weidong <wangweidong1@...wei.com>
To:	<jon.maloy@...csson.com>, <allan.stephens@...driver.com>,
	<davem@...emloft.net>
CC:	<netdev@...r.kernel.org>, <tipc-discussion@...ts.sourceforge.net>
Subject: [PATCH net-next 6/6] tipc: separate the check nseq and sseq allocate failed

if nseq allocate failed, sseq is no need to alloc. so separate the
check.

Signed-off-by: Wang Weidong <wangweidong1@...wei.com>
---
 net/tipc/name_table.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 92a1533..b91387c 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -159,12 +159,17 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt)
 static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
 {
 	struct name_seq *nseq = kzalloc(sizeof(*nseq), GFP_ATOMIC);
-	struct sub_seq *sseq = tipc_subseq_alloc(1);
+	struct sub_seq *sseq;
 
-	if (!nseq || !sseq) {
+	if (!nseq) {
 		pr_warn("Name sequence creation failed, no memory\n");
+		return NULL;
+	}
+
+	sseq = tipc_subseq_alloc(1);
+	if (!sseq) {
+		pr_warn("Sub sequence creation failed, no memory\n");
 		kfree(nseq);
-		kfree(sseq);
 		return NULL;
 	}
 
-- 
1.7.12


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists