Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750800AbWHUSxQ (ORCPT ); Mon, 21 Aug 2006 14:53:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750777AbWHUStD (ORCPT ); Mon, 21 Aug 2006 14:49:03 -0400 Received: from cantor2.suse.de ([195.135.220.15]:5053 "EHLO mx2.suse.de") by vger.kernel.org with ESMTP id S1750770AbWHUSs5 (ORCPT ); Mon, 21 Aug 2006 14:48:57 -0400 Date: Mon, 21 Aug 2006 11:47:23 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , torvalds@osdl.org, akpm@osdl.org, alan@lxorguk.ukuu.org.uk, Adrian Bunk , Patrick McHardy , Greg Kroah-Hartman Subject: [patch 14/20] : ip_tables: fix table locking in ipt_do_table Message-ID: <20060821184723.GO21938@kroah.com> References: <20060821183818.155091391@quad.kroah.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="ip_tables-fix-table-locking-in-ipt_do_table.patch" In-Reply-To: <20060821184527.GA21938@kroah.com> User-Agent: Mutt/1.5.12-2006-07-14 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2233 Lines: 63 -stable review patch. If anyone has any objections, please let us know. ------------------ From: Patrick McHardy [NETFILTER]: ip_tables: fix table locking in ipt_do_table table->private might change because of ruleset changes, don't use it without holding the lock. Signed-off-by: Patrick McHardy Signed-off-by: Greg Kroah-Hartman --- net/ipv4/netfilter/arp_tables.c | 3 ++- net/ipv4/netfilter/ip_tables.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) --- linux-2.6.17.9.orig/net/ipv4/netfilter/arp_tables.c +++ linux-2.6.17.9/net/ipv4/netfilter/arp_tables.c @@ -237,7 +237,7 @@ unsigned int arpt_do_table(struct sk_buf struct arpt_entry *e, *back; const char *indev, *outdev; void *table_base; - struct xt_table_info *private = table->private; + struct xt_table_info *private; /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ if (!pskb_may_pull((*pskb), (sizeof(struct arphdr) + @@ -249,6 +249,7 @@ unsigned int arpt_do_table(struct sk_buf outdev = out ? out->name : nulldevname; read_lock_bh(&table->lock); + private = table->private; table_base = (void *)private->entries[smp_processor_id()]; e = get_entry(table_base, private->hook_entry[hook]); back = get_entry(table_base, private->underflow[hook]); --- linux-2.6.17.9.orig/net/ipv4/netfilter/ip_tables.c +++ linux-2.6.17.9/net/ipv4/netfilter/ip_tables.c @@ -231,7 +231,7 @@ ipt_do_table(struct sk_buff **pskb, const char *indev, *outdev; void *table_base; struct ipt_entry *e, *back; - struct xt_table_info *private = table->private; + struct xt_table_info *private; /* Initialization */ ip = (*pskb)->nh.iph; @@ -248,6 +248,7 @@ ipt_do_table(struct sk_buff **pskb, read_lock_bh(&table->lock); IP_NF_ASSERT(table->valid_hooks & (1 << hook)); + private = table->private; table_base = (void *)private->entries[smp_processor_id()]; e = get_entry(table_base, private->hook_entry[hook]); -- - 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/