Re: [netfilter bug] BUG: using smp_processor_id() in preemptible[00000000] code: ssh/9115, caller is ipt_do_table+0xc8/0x559

From: Ingo Molnar
Date: Thu Apr 02 2009 - 16:32:57 EST



* Eric Dumazet <dada1@xxxxxxxxxxxxx> wrote:

> David put into its tree fix for that a few hours ago
>
> commit fa9a86ddc8ecd2830a5e773facc250f110300ae7
>
> (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.

ok, got your fix (attached below), thanks Eric for the pointer.

But i think my fix might be slightly better, because it does not
manipulate the preempt counter and leaves preemption enabled.

There's no BH context worries since this code did not seem to have
BH protection before either. (it used a plain read_lock(), not
read_lock_bh(), AFAICS)

I dont see any preemption worries either. I must be missing
something :)

With my patch applied the box appears to boot fine and there's no
syslog flood either. (no heavy testing done though)

Ingo

--------------->