net/sched: act_pedit: fix memory leak when IDR allocation fails

tcf_idr_check_alloc() can return a negative value, on allocation failures
(-ENOMEM) or IDR exhaustion (-ENOSPC): don't leak keys_ex in these cases.

Fixes: 0190c1d452 ("net: sched: atomically check-allocate action")
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Davide Caratti 2018-11-14 12:17:25 +01:00 committed by David S. Miller
parent 06bc4d0079
commit 19ab69107d
1 changed files with 2 additions and 1 deletions

View File

@ -201,7 +201,8 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
goto out_release;
}
} else {
return err;
ret = err;
goto out_free;
}
p = to_pedit(*a);