Thread (4 messages) flat view 4 messages, 1 author, 2017-11-08
STALE3227d

[PATCH 1/3] net: sched: cls_fw: Use common error handling code in fw_change()

From: SF Markus Elfring <hidden>
Date: 2017-11-08 18:41:50
Also in: kernel-janitors, lkml
Subsystem: networking [general], tc subsystem, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jamal Hadi Salim, Jiri Pirko, Linus Torvalds

From: Markus Elfring <redacted>
Date: Wed, 8 Nov 2017 19:15:08 +0100

Add a jump target so that a bit of exception handling can be better reused
in an if branch of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <redacted>
---
 net/sched/cls_fw.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 5908f56f76da..567db4d2349f 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -281,14 +281,13 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,
 		fnew->tp = f->tp;
 
 		err = tcf_exts_init(&fnew->exts, TCA_FW_ACT, TCA_FW_POLICE);
-		if (err < 0) {
-			kfree(fnew);
-			return err;
-		}
+		if (err < 0)
+			goto free_filter;
 
 		err = fw_set_parms(net, tp, fnew, tb, tca, base, ovr);
 		if (err < 0) {
 			tcf_exts_destroy(&fnew->exts);
+free_filter:
 			kfree(fnew);
 			return err;
 		}
-- 
2.15.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help