[PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface

Subsystems: netfilter, networking [general], the rest

STALE5093d

3 messages, 3 authors, 2012-08-22 · open the first message on its own page

[PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface

From: Michael Wang <hidden>
Date: 2012-08-17 04:34:08

From: Michael Wang <redacted>

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

Re: [PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface

From: Paul E. McKenney <hidden>
Date: 2012-08-21 00:04:27

On Fri, Aug 17, 2012 at 12:33:39PM +0800, Michael Wang wrote:
From: Michael Wang <redacted>

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 <redacted>
Reviewed-by: Paul E. McKenney <redacted>
quoted hunk
---
 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

Re: [PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface

From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: 2012-08-22 22:32:33

On Fri, Aug 17, 2012 at 12:33:39PM +0800, Michael Wang wrote:
From: Michael Wang <redacted>

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help