Skip to content

Commit

Permalink
net: sched: act_ife: fix memory leak in ife init
Browse files Browse the repository at this point in the history
Free params if tcf_idr_check_alloc() returned error.

Fixes: 0190c1d ("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>
  • Loading branch information
Vlad Buslov authored and David S. Miller committed Jul 12, 2018
1 parent 8dce04f commit 01e866b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/sched/act_ife.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 01e866b

Please sign in to comment.