From da28556e0ab3bcdc550d6b2b975d0f6e8d2198ff Mon Sep 17 00:00:00 2001 From: Luis Claudio R. Goncalves 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" Signed-off-by: Thomas Gleixner Signed-off-by: Paul Gortmaker --- net/bridge/netfilter/ebtables.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index f0865fd..2f566fd 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -177,7 +177,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; @@ -198,12 +198,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.0.4