提交 ae06e2f9 编写于 作者: D Davide Caratti 提交者: Greg Kroah-Hartman

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

[ Upstream commit 19ab69107d3ecfb7cd3e38ad262a881be40c01a3 ]

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: NDavide Caratti <dcaratti@redhat.com>
Acked-by: NCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 3d6679c8
...@@ -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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册