summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2016-06-13 13:44:14 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-07-11 09:30:00 -0700
commitaae4204718b75dbafe5957a331ce4bc479285eb8 (patch)
tree3154e5e03dc7f0e862103c876098dce00b876bee
parent6a23e18a677464b3e20fed580893efdfd018f80a (diff)
downloadlwn-aae4204718b75dbafe5957a331ce4bc479285eb8.tar.gz
lwn-aae4204718b75dbafe5957a331ce4bc479285eb8.zip
act_ipt: fix a bind refcnt leak
[ Upstream commit d15eccea69b96a5116169688dcc9baf6d1ce2751 ] And avoid calling tcf_hash_check() twice. Fixes: a57f19d30b2d ("net sched: ipt action fix late binding") Cc: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/sched/act_ipt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 8b5270008a6e..606323339e1f 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -121,10 +121,13 @@ static int __tcf_ipt_init(struct tc_action_net *tn, struct nlattr *nla,
}
td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]);
- if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size)
+ if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) {
+ if (exists)
+ tcf_hash_release(a, bind);
return -EINVAL;
+ }
- if (!tcf_hash_check(tn, index, a, bind)) {
+ if (!exists) {
ret = tcf_hash_create(tn, index, est, a, sizeof(*ipt), bind,
false);
if (ret)