linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface
       [not found] <502CB939.3050008@linux.vnet.ibm.com>
@ 2012-08-17  4:33 ` Michael Wang
  2012-08-21  0:02   ` Paul E. McKenney
  2012-08-22 22:32   ` Pablo Neira Ayuso
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Wang @ 2012-08-17  4:33 UTC (permalink / raw)
  To: LKML, netdev, netfilter, coreteam, netfilter-devel
  Cc: David Miller, kaber, pablo, paulmck

From: Michael Wang <wangyun@linux.vnet.ibm.com>

This patch replaces list_for_each_continue_rcu() with
list_for_each_entry_continue_rcu() to allow removing
list_for_each_continue_rcu().

Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
---
 net/netfilter/core.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index e19f365..50225bd 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -131,14 +131,14 @@ unsigned int nf_iterate(struct list_head *head,
 			int hook_thresh)
 {
 	unsigned int verdict;
+	struct nf_hook_ops *elem = list_entry_rcu(*i,
+						struct nf_hook_ops, list);

 	/*
 	 * The caller must not block between calls to this
 	 * function because of risk of continuing from deleted element.
 	 */
-	list_for_each_continue_rcu(*i, head) {
-		struct nf_hook_ops *elem = (struct nf_hook_ops *)*i;
-
+	list_for_each_entry_continue_rcu(elem, head, list) {
 		if (hook_thresh > elem->priority)
 			continue;

@@ -155,11 +155,14 @@ repeat:
 				continue;
 			}
 #endif
-			if (verdict != NF_REPEAT)
+			if (verdict != NF_REPEAT) {
+				*i = &elem->list;
 				return verdict;
+			}
 			goto repeat;
 		}
 	}
+	*i = &elem->list;
 	return NF_ACCEPT;
 }

-- 
1.7.4.1



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

* Re: [PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface
  2012-08-17  4:33 ` [PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface Michael Wang
@ 2012-08-21  0:02   ` Paul E. McKenney
  2012-08-22 22:32   ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2012-08-21  0:02 UTC (permalink / raw)
  To: Michael Wang
  Cc: LKML, netdev, netfilter, coreteam, netfilter-devel, David Miller,
	kaber, pablo

On Fri, Aug 17, 2012 at 12:33:39PM +0800, Michael Wang wrote:
> From: Michael Wang <wangyun@linux.vnet.ibm.com>
> 
> This patch replaces list_for_each_continue_rcu() with
> list_for_each_entry_continue_rcu() to allow removing
> list_for_each_continue_rcu().
> 
> Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> ---
>  net/netfilter/core.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/net/netfilter/core.c b/net/netfilter/core.c
> index e19f365..50225bd 100644
> --- a/net/netfilter/core.c
> +++ b/net/netfilter/core.c
> @@ -131,14 +131,14 @@ unsigned int nf_iterate(struct list_head *head,
>  			int hook_thresh)
>  {
>  	unsigned int verdict;
> +	struct nf_hook_ops *elem = list_entry_rcu(*i,
> +						struct nf_hook_ops, list);
> 
>  	/*
>  	 * The caller must not block between calls to this
>  	 * function because of risk of continuing from deleted element.
>  	 */
> -	list_for_each_continue_rcu(*i, head) {
> -		struct nf_hook_ops *elem = (struct nf_hook_ops *)*i;
> -
> +	list_for_each_entry_continue_rcu(elem, head, list) {
>  		if (hook_thresh > elem->priority)
>  			continue;
> 
> @@ -155,11 +155,14 @@ repeat:
>  				continue;
>  			}
>  #endif
> -			if (verdict != NF_REPEAT)
> +			if (verdict != NF_REPEAT) {
> +				*i = &elem->list;
>  				return verdict;
> +			}
>  			goto repeat;
>  		}
>  	}
> +	*i = &elem->list;
>  	return NF_ACCEPT;
>  }
> 
> -- 
> 1.7.4.1
> 
> 


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

* Re: [PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface
  2012-08-17  4:33 ` [PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface Michael Wang
  2012-08-21  0:02   ` Paul E. McKenney
@ 2012-08-22 22:32   ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2012-08-22 22:32 UTC (permalink / raw)
  To: Michael Wang
  Cc: LKML, netdev, netfilter, coreteam, netfilter-devel, David Miller,
	kaber, paulmck

On Fri, Aug 17, 2012 at 12:33:39PM +0800, Michael Wang wrote:
> From: Michael Wang <wangyun@linux.vnet.ibm.com>
> 
> This patch replaces list_for_each_continue_rcu() with
> list_for_each_entry_continue_rcu() to allow removing
> list_for_each_continue_rcu().

Applied, thanks.

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

end of thread, other threads:[~2012-08-22 22:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <502CB939.3050008@linux.vnet.ibm.com>
2012-08-17  4:33 ` [PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface Michael Wang
2012-08-21  0:02   ` Paul E. McKenney
2012-08-22 22:32   ` Pablo Neira Ayuso

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