netfilter: replace list_for_each_continue_rcu with new interface
authorMichael Wang <wangyun@linux.vnet.ibm.com>
Thu, 16 Aug 2012 18:33:39 +0000 (18:33 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 22 Aug 2012 17:17:20 +0000 (19:17 +0200)
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/core.c

index 0bc6b60db4df2fda1a7cd2f1b57747f655d046a3..8f4b0b2b6f8033ed696671f8538a260d19e84466 100644 (file)
@@ -131,14 +131,13 @@ 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 +154,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;
 }