summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Buslov <vladbu@mellanox.com>2018-07-09 14:33:26 +0300
committerDavid S. Miller <davem@davemloft.net>2018-07-11 22:53:00 -0700
commit01e866bf07fbb10e96bff46ea1e5e0410d6e40b9 (patch)
tree6800ce7630dd3a10f1c30b1dbe02696e58eb2094
parent8dce04f1fd64ce5cf03e942d7644967890ae4483 (diff)
net: sched: act_ife: fix memory leak in ife init
Free params if tcf_idr_check_alloc() returned error. Fixes: 0190c1d452a9 ("net: sched: atomically check-allocate action") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/act_ife.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index a3eef00cd711..3d6e265758c0 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);