* [PATCH][nf-next] netfilter: Use RCU primitives under RCU protected data
@ 2019-02-25 3:32 Li RongQing
2019-02-25 3:52 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Li RongQing @ 2019-02-25 3:32 UTC (permalink / raw)
To: netfilter-devel
This pointer is RCU protected, so proper primitives should be used.
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
net/netfilter/xt_CT.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c
index 0fa863f57575..26dee8bba326 100644
--- a/net/netfilter/xt_CT.c
+++ b/net/netfilter/xt_CT.c
@@ -99,7 +99,7 @@ xt_ct_set_helper(struct nf_conn *ct, const char *helper_name,
return -ENOMEM;
}
- help->helper = helper;
+ RCU_INIT_POINTER(help->helper, helper);
return 0;
}
@@ -274,7 +274,7 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par,
err4:
help = nfct_help(ct);
if (help)
- nf_conntrack_helper_put(help->helper);
+ nf_conntrack_helper_put(rcu_dereference(help->helper));
err3:
nf_ct_tmpl_free(ct);
err2:
@@ -357,7 +357,7 @@ static void xt_ct_tg_destroy(const struct xt_tgdtor_param *par,
if (ct) {
help = nfct_help(ct);
if (help)
- nf_conntrack_helper_put(help->helper);
+ nf_conntrack_helper_put(rcu_dereference(help->helper));
nf_ct_netns_put(par->net, par->family);
--
2.16.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][nf-next] netfilter: Use RCU primitives under RCU protected data
2019-02-25 3:32 [PATCH][nf-next] netfilter: Use RCU primitives under RCU protected data Li RongQing
@ 2019-02-25 3:52 ` Eric Dumazet
2019-02-25 4:05 ` 答复: " Li,Rongqing
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2019-02-25 3:52 UTC (permalink / raw)
To: Li RongQing, netfilter-devel
On 02/24/2019 07:32 PM, Li RongQing wrote:
> This pointer is RCU protected, so proper primitives should be used.
>
> Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> net/netfilter/xt_CT.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c
> index 0fa863f57575..26dee8bba326 100644
> --- a/net/netfilter/xt_CT.c
> +++ b/net/netfilter/xt_CT.c
> @@ -99,7 +99,7 @@ xt_ct_set_helper(struct nf_conn *ct, const char *helper_name,
> return -ENOMEM;
> }
>
> - help->helper = helper;
> + RCU_INIT_POINTER(help->helper, helper);
> return 0;
> }
>
> @@ -274,7 +274,7 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par,
> err4:
> help = nfct_help(ct);
> if (help)
> - nf_conntrack_helper_put(help->helper);
> + nf_conntrack_helper_put(rcu_dereference(help->helper));
Are you sure it is ok, have you tested your patch ?
Where is the rcu_read_lock() ?
CONFIG_PROVE_RCU=y will likely give a splat here.
> err3:
> nf_ct_tmpl_free(ct);
> err2:
> @@ -357,7 +357,7 @@ static void xt_ct_tg_destroy(const struct xt_tgdtor_param *par,
> if (ct) {
> help = nfct_help(ct);
> if (help)
> - nf_conntrack_helper_put(help->helper);
> + nf_conntrack_helper_put(rcu_dereference(help->helper));
Same here.
>
> nf_ct_netns_put(par->net, par->family);
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* 答复: [PATCH][nf-next] netfilter: Use RCU primitives under RCU protected data
2019-02-25 3:52 ` Eric Dumazet
@ 2019-02-25 4:05 ` Li,Rongqing
0 siblings, 0 replies; 3+ messages in thread
From: Li,Rongqing @ 2019-02-25 4:05 UTC (permalink / raw)
To: Eric Dumazet, netfilter-devel@vger.kernel.org
> -----邮件原件-----
> 发件人: Eric Dumazet [mailto:eric.dumazet@gmail.com]
> 发送时间: 2019年2月25日 11:53
> 收件人: Li,Rongqing <lirongqing@baidu.com>; netfilter-devel@vger.kernel.org
> 主题: Re: [PATCH][nf-next] netfilter: Use RCU primitives under RCU protected
> data
>
>
>
> On 02/24/2019 07:32 PM, Li RongQing wrote:
> > This pointer is RCU protected, so proper primitives should be used.
> >
> > Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
> > ---
> > net/netfilter/xt_CT.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index
> > 0fa863f57575..26dee8bba326 100644
> > --- a/net/netfilter/xt_CT.c
> > +++ b/net/netfilter/xt_CT.c
> > @@ -99,7 +99,7 @@ xt_ct_set_helper(struct nf_conn *ct, const char
> *helper_name,
> > return -ENOMEM;
> > }
> >
> > - help->helper = helper;
> > + RCU_INIT_POINTER(help->helper, helper);
> > return 0;
> > }
> >
> > @@ -274,7 +274,7 @@ static int xt_ct_tg_check(const struct
> > xt_tgchk_param *par,
> > err4:
> > help = nfct_help(ct);
> > if (help)
> > - nf_conntrack_helper_put(help->helper);
> > + nf_conntrack_helper_put(rcu_dereference(help->helper));
>
> Are you sure it is ok, have you tested your patch ?
>
> Where is the rcu_read_lock() ?
>
> CONFIG_PROVE_RCU=y will likely give a splat here.
>
Thanks, I will test it as your suggestion
-RongQing
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-25 4:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-25 3:32 [PATCH][nf-next] netfilter: Use RCU primitives under RCU protected data Li RongQing
2019-02-25 3:52 ` Eric Dumazet
2019-02-25 4:05 ` 答复: " Li,Rongqing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).