[NETFILTER]: ip_tables: fix table locking in ipt_do_table
authorPatrick McHardy <kaber@trash.net>
Fri, 18 Aug 2006 01:13:53 +0000 (18:13 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Aug 2006 01:13:53 +0000 (18:13 -0700)
table->private might change because of ruleset changes, don't use it without
holding the lock.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/netfilter/ip_tables.c

index f316ff5fd8a64ff7cf4096e583760977c1d5403f..048514f15f2ffe116dcbebc0aa1672eae54045f4 100644 (file)
@@ -230,7 +230,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;
@@ -247,6 +247,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]);