blob: 16edc835f80d0a7527cb2bedb46404903ba507a3 [file] [log] [blame]
From 58995ce91b62da5633298620a5cf5862f381223c Mon Sep 17 00:00:00 2001
From: Luis Claudio R. Goncalves <lclaudio@uudg.org>
Date: Sat, 27 Nov 2010 13:04:05 -0200
Subject: [PATCH] net: ebtables: Work around per cpu assumptions
commit a1026af461530b4f0a875c4bdffac4137b2db549 in tip.
I have been seeing several variations of this BUG message:
BUG: using smp_processor_id() in preemptible [00000000] code: ...
caller is ebt_do_table+0x94/0x60c [ebtables]
Disable preemption while fetching and using the ID of the current CPU.
Signed-off-by: "Luis Claudio R. Goncalves" <lclaudio@uudg.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index dfb5805..1946471 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -176,7 +176,7 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
struct ebt_table *table)
{
- int i, nentries;
+ int i, nentries, cpu;
struct ebt_entry *point;
struct ebt_counter *counter_base, *cb_base;
const struct ebt_entry_target *t;
@@ -197,12 +197,14 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff *skb,
read_lock_bh(&table->lock);
private = table->private;
- cb_base = COUNTER_BASE(private->counters, private->nentries,
- smp_processor_id());
+ preempt_disable_rt();
+ cpu = smp_processor_id();
+ cb_base = COUNTER_BASE(private->counters, private->nentries, cpu);
if (private->chainstack)
- cs = private->chainstack[smp_processor_id()];
+ cs = private->chainstack[cpu];
else
cs = NULL;
+ preempt_enable_rt();
chaininfo = private->hook_entry[hook];
nentries = private->hook_entry[hook]->nentries;
point = (struct ebt_entry *)(private->hook_entry[hook]->data);
--
1.7.1.1