linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] netfilter: fix list_entry_rcu usage.
@ 2015-03-24 10:31 Patrick Marlier
  2015-03-25 14:36 ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Marlier @ 2015-03-24 10:31 UTC (permalink / raw)
  To: linux-kernel

Signed-off-by: Patrick Marlier <patrick.marlier@gmail.com>
---
  net/netfilter/core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index fea9ef5..05bd311 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -174,7 +174,7 @@ int nf_hook_slow(u_int8_t pf, unsigned int hook, 
struct sk_buff *skb,
     /* We may already have this, but read-locks nest anyway */
     rcu_read_lock();

-   elem = list_entry_rcu(&nf_hooks[pf][hook], struct nf_hook_ops, list);
+   elem = list_entry_rcu(nf_hooks[pf][hook].next, struct nf_hook_ops, 
list);
  next_hook:
     verdict = nf_iterate(&nf_hooks[pf][hook], skb, hook, indev,
                  outdev, &elem, okfn, hook_thresh);
-- 
2.1.0


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

* Re: [PATCH 2/3] netfilter: fix list_entry_rcu usage.
  2015-03-24 10:31 [PATCH 2/3] netfilter: fix list_entry_rcu usage Patrick Marlier
@ 2015-03-25 14:36 ` Paul E. McKenney
  2015-03-25 15:11   ` Patrick Marlier
  0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2015-03-25 14:36 UTC (permalink / raw)
  To: Patrick Marlier; +Cc: linux-kernel

On Tue, Mar 24, 2015 at 11:31:44AM +0100, Patrick Marlier wrote:
> Signed-off-by: Patrick Marlier <patrick.marlier@gmail.com>
> ---
>  net/netfilter/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/core.c b/net/netfilter/core.c
> index fea9ef5..05bd311 100644
> --- a/net/netfilter/core.c
> +++ b/net/netfilter/core.c
> @@ -174,7 +174,7 @@ int nf_hook_slow(u_int8_t pf, unsigned int hook,
> struct sk_buff *skb,
>     /* We may already have this, but read-locks nest anyway */
>     rcu_read_lock();
> 
> -   elem = list_entry_rcu(&nf_hooks[pf][hook], struct nf_hook_ops, list);
> +   elem = list_entry_rcu(nf_hooks[pf][hook].next, struct nf_hook_ops, list);

And this departs from the list_entry() API.  Is this really a good idea?

							Thanx, Paul

>  next_hook:
>     verdict = nf_iterate(&nf_hooks[pf][hook], skb, hook, indev,
>                  outdev, &elem, okfn, hook_thresh);
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


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

* Re: [PATCH 2/3] netfilter: fix list_entry_rcu usage.
  2015-03-25 14:36 ` Paul E. McKenney
@ 2015-03-25 15:11   ` Patrick Marlier
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Marlier @ 2015-03-25 15:11 UTC (permalink / raw)
  To: paulmck; +Cc: linux-kernel

On 03/25/2015 03:36 PM, Paul E. McKenney wrote:
> On Tue, Mar 24, 2015 at 11:31:44AM +0100, Patrick Marlier wrote:
>> >Signed-off-by: Patrick Marlier<patrick.marlier@gmail.com>
>> >---
>> >  net/netfilter/core.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> >diff --git a/net/netfilter/core.c b/net/netfilter/core.c
>> >index fea9ef5..05bd311 100644
>> >--- a/net/netfilter/core.c
>> >+++ b/net/netfilter/core.c
>> >@@ -174,7 +174,7 @@ int nf_hook_slow(u_int8_t pf, unsigned int hook,
>> >struct sk_buff *skb,
>> >     /* We may already have this, but read-locks nest anyway */
>> >     rcu_read_lock();
>> >
>> >-   elem = list_entry_rcu(&nf_hooks[pf][hook], struct nf_hook_ops, list);
>> >+   elem = list_entry_rcu(nf_hooks[pf][hook].next, struct nf_hook_ops, list);
> And this departs from the list_entry() API.  Is this really a good idea?

No opinion on that but AFAIK there are only 2 spots in the whole kernel 
source where the ".next" is not used with list_entry_rcu.
--
Patrick Marlier

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

end of thread, other threads:[~2015-03-25 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-24 10:31 [PATCH 2/3] netfilter: fix list_entry_rcu usage Patrick Marlier
2015-03-25 14:36 ` Paul E. McKenney
2015-03-25 15:11   ` Patrick Marlier

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