All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch net] act_ipt: fix a bind refcnt leak
@ 2016-06-13 20:44 Cong Wang
  2016-06-13 21:56 ` Jamal Hadi Salim
  2016-06-15 19:32 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Cong Wang @ 2016-06-13 20:44 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Jamal Hadi Salim

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>
---
 net/sched/act_ipt.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 9f002ad..d4bd19e 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)
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Patch net] act_ipt: fix a bind refcnt leak
  2016-06-13 20:44 [Patch net] act_ipt: fix a bind refcnt leak Cong Wang
@ 2016-06-13 21:56 ` Jamal Hadi Salim
  2016-06-15 19:32 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Jamal Hadi Salim @ 2016-06-13 21:56 UTC (permalink / raw)
  To: Cong Wang, netdev

On 16-06-13 04:44 PM, Cong Wang wrote:
> 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>

Good catch.
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch net] act_ipt: fix a bind refcnt leak
  2016-06-13 20:44 [Patch net] act_ipt: fix a bind refcnt leak Cong Wang
  2016-06-13 21:56 ` Jamal Hadi Salim
@ 2016-06-15 19:32 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-06-15 19:32 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, jhs

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 13 Jun 2016 13:44:14 -0700

> 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>

Applied, and queued up for -stable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-15 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13 20:44 [Patch net] act_ipt: fix a bind refcnt leak Cong Wang
2016-06-13 21:56 ` Jamal Hadi Salim
2016-06-15 19:32 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.