netfilter: replace list_for_each_continue_rcu with new interface

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>
This commit is contained in:
Michael Wang
2012-08-16 18:33:39 +00:00
committed by Pablo Neira Ayuso
parent 2834a6386b
commit 6705e86724

View File

@@ -131,14 +131,13 @@ unsigned int nf_iterate(struct list_head *head,
int hook_thresh) int hook_thresh)
{ {
unsigned int verdict; 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 * The caller must not block between calls to this
* function because of risk of continuing from deleted element. * function because of risk of continuing from deleted element.
*/ */
list_for_each_continue_rcu(*i, head) { list_for_each_entry_continue_rcu(elem, head, list) {
struct nf_hook_ops *elem = (struct nf_hook_ops *)*i;
if (hook_thresh > elem->priority) if (hook_thresh > elem->priority)
continue; continue;
@@ -155,11 +154,14 @@ repeat:
continue; continue;
} }
#endif #endif
if (verdict != NF_REPEAT) if (verdict != NF_REPEAT) {
*i = &elem->list;
return verdict; return verdict;
}
goto repeat; goto repeat;
} }
} }
*i = &elem->list;
return NF_ACCEPT; return NF_ACCEPT;
} }