Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753709Ab2HQEeI (ORCPT ); Fri, 17 Aug 2012 00:34:08 -0400 Received: from e23smtp04.au.ibm.com ([202.81.31.146]:41690 "EHLO e23smtp04.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753341Ab2HQEdt (ORCPT ); Fri, 17 Aug 2012 00:33:49 -0400 Message-ID: <502DC9A3.2070703@linux.vnet.ibm.com> Date: Fri, 17 Aug 2012 12:33:39 +0800 From: Michael Wang User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: LKML , "netdev@vger.kernel.org" , netfilter@vger.kernel.org, coreteam@netfilter.org, netfilter-devel@vger.kernel.org CC: David Miller , kaber@trash.net, pablo@netfilter.org, "paulmck@linux.vnet.ibm.com" Subject: [PATCH 3/3] netfilter: replace list_for_each_continue_rcu with new interface References: <502CB939.3050008@linux.vnet.ibm.com> In-Reply-To: <502CB939.3050008@linux.vnet.ibm.com> X-Forwarded-Message-Id: <502CB939.3050008@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit x-cbid: 12081704-9264-0000-0000-000002253723 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1518 Lines: 58 From: Michael Wang 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 --- 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 -- 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/