[NETFILTER]: arp_tables: fix table locking in arpt_do_table
authorPatrick McHardy <kaber@trash.net>
Mon, 21 Aug 2006 22:31:08 +0000 (15:31 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 22 Aug 2006 21:33:56 +0000 (14:33 -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/arp_tables.c

index df4854cf598bbea46da6b19b6c2bb0ffdc0436fe..8d1d7a6e72a563149c253d52c292f259b7e87884 100644 (file)
@@ -236,7 +236,7 @@ unsigned int arpt_do_table(struct sk_buff **pskb,
        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) +
@@ -248,6 +248,7 @@ unsigned int arpt_do_table(struct sk_buff **pskb,
        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]);