public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox•net>
To: Cong Wang <xiyou.wangcong@gmail•com>, netdev@vger•kernel.org
Cc: davem@davemloft•net, Jamal Hadi Salim <jhs@mojatatu•com>,
	Cong Wang <cwang@twopensource•com>
Subject: Re: [Patch net] act_mirred: avoid calling tcf_hash_release() when binding
Date: Fri, 31 Jul 2015 12:06:48 +0200	[thread overview]
Message-ID: <55BB48B8.6060201@iogearbox.net> (raw)
In-Reply-To: <1438301541-26192-1-git-send-email-xiyou.wangcong@gmail.com>

On 07/31/2015 02:12 AM, Cong Wang wrote:
> When we share an action within a filter, the bind refcnt
> should increase, therefore we should not call tcf_hash_release().
>
> Cc: Jamal Hadi Salim <jhs@mojatatu•com>
> Cc: Daniel Borkmann <daniel@iogearbox•net>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail•com>
> Signed-off-by: Cong Wang <cwang@twopensource•com>
> ---
>   net/sched/act_mirred.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
> index a42a3b2..2685450 100644
> --- a/net/sched/act_mirred.c
> +++ b/net/sched/act_mirred.c
> @@ -98,6 +98,8 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
>   			return ret;
>   		ret = ACT_P_CREATED;
>   	} else {
> +		if (bind)
> +			return 0;
>   		if (!ovr) {
>   			tcf_hash_release(a, bind);
>   			return -EEXIST;
>

Did you test all variants on this?

I.e. what happens when you replace an existing one, I think the
refcnt should also be dropped here. It looks like we only drop
it, in case we tried to add an action to an already existing index ...

	[...]
	} else {
		if (bind)
			return 0;
		tcf_hash_release(a, bind);
		if (!ovr)
			return -EEXIST;
	}
	[...]

Thanks,
Daniel

  parent reply	other threads:[~2015-07-31 10:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-31  0:12 [Patch net] act_mirred: avoid calling tcf_hash_release() when binding Cong Wang
2015-07-31  0:12 ` [Patch net] act_pedit: check binding before calling tcf_hash_release() Cong Wang
2015-07-31 11:10   ` Daniel Borkmann
2015-07-31 22:23   ` David Miller
2015-07-31 10:06 ` Daniel Borkmann [this message]
2015-07-31 22:25   ` [Patch net] act_mirred: avoid calling tcf_hash_release() when binding Cong Wang
2015-07-31 22:33     ` Daniel Borkmann
2015-08-03 21:13 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55BB48B8.6060201@iogearbox.net \
    --to=daniel@iogearbox$(echo .)net \
    --cc=cwang@twopensource$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=jhs@mojatatu$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=xiyou.wangcong@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox