Skip to content

Commit d15ecce

Browse files
congwangdavem330
authored andcommitted
act_ipt: fix a bind refcnt leak
And avoid calling tcf_hash_check() twice. Fixes: a57f19d ("net sched: ipt action fix late binding") Cc: Jamal Hadi Salim <[email protected]> Signed-off-by: Cong Wang <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3d7c825 commit d15ecce

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/sched/act_ipt.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,13 @@ static int __tcf_ipt_init(struct tc_action_net *tn, struct nlattr *nla,
121121
}
122122

123123
td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]);
124-
if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size)
124+
if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) {
125+
if (exists)
126+
tcf_hash_release(a, bind);
125127
return -EINVAL;
128+
}
126129

127-
if (!tcf_hash_check(tn, index, a, bind)) {
130+
if (!exists) {
128131
ret = tcf_hash_create(tn, index, est, a, sizeof(*ipt), bind,
129132
false);
130133
if (ret)

0 commit comments

Comments
 (0)