net: sched: act_ife: fix memory leak in ife init
authorVlad Buslov <vladbu@mellanox.com>
Mon, 9 Jul 2018 11:33:26 +0000 (14:33 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 Jul 2018 05:53:00 +0000 (22:53 -0700)
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>
net/sched/act_ife.c

index a3eef00..3d6e265 100644 (file)
@@ -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);