Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d15eccea authored by WANG Cong's avatar WANG Cong Committed by David S. Miller
Browse files

act_ipt: fix a bind refcnt leak



And avoid calling tcf_hash_check() twice.

Fixes: a57f19d3 ("net sched: ipt action fix late binding")
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d7c8257
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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)