Commit 19ab6910 authored by Davide Caratti's avatar Davide Caratti Committed by David S. Miller

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: 0190c1d4 ("net: sched: atomically check-allocate action")
Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
Acked-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 06bc4d00
...@@ -201,7 +201,8 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla, ...@@ -201,7 +201,8 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
goto out_release; goto out_release;
} }
} else { } else {
return err; ret = err;
goto out_free;
} }
p = to_pedit(*a); p = to_pedit(*a);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment