[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20180710135347.GA15889@embeddedor.com>
Date: Tue, 10 Jul 2018 08:53:47 -0500
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
"David S. Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Vlad Buslov <vladbu@...lanox.com>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: [PATCH] net: sched: act_ife: fix memory leak
In case memory resources for *p* are allocated, release them
before return.
Addresses-Coverity-ID: 1471714 ("Resource leak")
Fixes: 0190c1d452a9 ("net: sched: atomically check-allocate action")
Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
---
net/sched/act_ife.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index a3eef00..3d6e265 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -485,8 +485,10 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
return -ENOMEM;
err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
- if (err < 0)
+ if (err < 0) {
+ kfree(p);
return err;
+ }
exists = err;
if (exists && bind) {
kfree(p);
--
2.7.4
Powered by blists - more mailing lists