]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ip_tables: fix table locking in ipt_do_table
authorPatrick McHardy <kaber@trash.net>
Wed, 30 Aug 2006 15:25:57 +0000 (17:25 +0200)
committerAdrian Bunk <bunk@stusta.de>
Wed, 30 Aug 2006 15:25:57 +0000 (17:25 +0200)
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: Adrian Bunk <bunk@stusta.de>
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c

index 12bfc257743454c2e43e4fdaaff27d9b20dc51ab..dbbda6b9ac77904412d4561ac34fa55fd3f14d2d 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]);
index 735d5ff5061b2a8d43c3800231f2d3b745377c01..835d669aabc90512db209e6913cc167eb21fd488 100644 (file)
@@ -229,7 +229,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;
@@ -246,6 +246,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]);