Commit fa9a86dd authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

netfilter: use rcu_read_bh() in ipt_do_table()

Commit 78454473
(netfilter: iptables: lock free counters) forgot to disable BH
in arpt_do_table(), ipt_do_table() and  ip6t_do_table()

Use rcu_read_lock_bh() instead of rcu_read_lock() cures the problem.
Reported-and-bisected-by: default avatarRoman Mindalev <r000n@r000n.net>
Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
Acked-by: default avatarPatrick McHardy <kaber@trash.net>
Acked-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8cbd9606
...@@ -253,7 +253,7 @@ unsigned int arpt_do_table(struct sk_buff *skb, ...@@ -253,7 +253,7 @@ unsigned int arpt_do_table(struct sk_buff *skb,
indev = in ? in->name : nulldevname; indev = in ? in->name : nulldevname;
outdev = out ? out->name : nulldevname; outdev = out ? out->name : nulldevname;
rcu_read_lock(); rcu_read_lock_bh();
private = rcu_dereference(table->private); private = rcu_dereference(table->private);
table_base = rcu_dereference(private->entries[smp_processor_id()]); table_base = rcu_dereference(private->entries[smp_processor_id()]);
...@@ -329,7 +329,7 @@ unsigned int arpt_do_table(struct sk_buff *skb, ...@@ -329,7 +329,7 @@ unsigned int arpt_do_table(struct sk_buff *skb,
} }
} while (!hotdrop); } while (!hotdrop);
rcu_read_unlock(); rcu_read_unlock_bh();
if (hotdrop) if (hotdrop)
return NF_DROP; return NF_DROP;
......
...@@ -339,7 +339,7 @@ ipt_do_table(struct sk_buff *skb, ...@@ -339,7 +339,7 @@ ipt_do_table(struct sk_buff *skb,
IP_NF_ASSERT(table->valid_hooks & (1 << hook)); IP_NF_ASSERT(table->valid_hooks & (1 << hook));
rcu_read_lock(); rcu_read_lock_bh();
private = rcu_dereference(table->private); private = rcu_dereference(table->private);
table_base = rcu_dereference(private->entries[smp_processor_id()]); table_base = rcu_dereference(private->entries[smp_processor_id()]);
...@@ -437,7 +437,7 @@ ipt_do_table(struct sk_buff *skb, ...@@ -437,7 +437,7 @@ ipt_do_table(struct sk_buff *skb,
} }
} while (!hotdrop); } while (!hotdrop);
rcu_read_unlock(); rcu_read_unlock_bh();
#ifdef DEBUG_ALLOW_ALL #ifdef DEBUG_ALLOW_ALL
return NF_ACCEPT; return NF_ACCEPT;
......
...@@ -365,7 +365,7 @@ ip6t_do_table(struct sk_buff *skb, ...@@ -365,7 +365,7 @@ ip6t_do_table(struct sk_buff *skb,
IP_NF_ASSERT(table->valid_hooks & (1 << hook)); IP_NF_ASSERT(table->valid_hooks & (1 << hook));
rcu_read_lock(); rcu_read_lock_bh();
private = rcu_dereference(table->private); private = rcu_dereference(table->private);
table_base = rcu_dereference(private->entries[smp_processor_id()]); table_base = rcu_dereference(private->entries[smp_processor_id()]);
...@@ -466,7 +466,7 @@ ip6t_do_table(struct sk_buff *skb, ...@@ -466,7 +466,7 @@ ip6t_do_table(struct sk_buff *skb,
#ifdef CONFIG_NETFILTER_DEBUG #ifdef CONFIG_NETFILTER_DEBUG
((struct ip6t_entry *)table_base)->comefrom = NETFILTER_LINK_POISON; ((struct ip6t_entry *)table_base)->comefrom = NETFILTER_LINK_POISON;
#endif #endif
rcu_read_unlock(); rcu_read_unlock_bh();
#ifdef DEBUG_ALLOW_ALL #ifdef DEBUG_ALLOW_ALL
return NF_ACCEPT; return NF_ACCEPT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment