Skip to content

Commit

Permalink
act_ipt: fix a bind refcnt leak
Browse files Browse the repository at this point in the history
And avoid calling tcf_hash_check() twice.

Fixes: a57f19d ("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>
  • Loading branch information
WANG Cong authored and David S. Miller committed Jun 15, 2016
1 parent 3d7c825 commit d15ecce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions net/sched/act_ipt.c
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit d15ecce

Please sign in to comment.