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:   Wed, 8 Nov 2017 21:36:26 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     netdev@...r.kernel.org, Cong Wang <xiyou.wangcong@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Jiri Pirko <jiri@...nulli.us>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] net/sched/cls_tcindex: Use common error handling code in
 tcindex_set_parms()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 8 Nov 2017 21:10:49 +0100

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 net/sched/cls_tcindex.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index d6abfa6757f2..24f05bc09084 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -437,10 +437,8 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
 		f->key = handle;
 		f->next = NULL;
 		err = tcindex_filter_result_init(&f->result);
-		if (err < 0) {
-			kfree(f);
-			goto errout_alloc;
-		}
+		if (err < 0)
+			goto err_free_filter;
 	}
 
 	if (tb[TCA_TCINDEX_CLASSID]) {
@@ -455,10 +453,8 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
 
 	if (old_r && old_r != r) {
 		err = tcindex_filter_result_init(old_r);
-		if (err < 0) {
-			kfree(f);
-			goto errout_alloc;
-		}
+		if (err < 0)
+			goto err_free_filter;
 	}
 
 	oldp = p;
@@ -484,6 +480,8 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
 		call_rcu(&oldp->rcu, __tcindex_partial_destroy);
 	return 0;
 
+err_free_filter:
+	kfree(f);
 errout_alloc:
 	if (balloc == 1)
 		tcindex_free_perfect_hash(cp);
-- 
2.15.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ