Re: Kernel BUG using iptable

From: Patrick McHardy
Date: Wed Jun 15 2005 - 06:30:49 EST


thibault dory wrote:
> Since I try to use iptable with kernel 2.6.11.X serie I get the same
> bug with iptable. It didn't work at all and I experience problems with
> my connection. I give you my kernel config file in attachement.
> For the moment I'm using 2.6.11.12 kernel on a 1.4Ghz Centrino.
>
> BUG: using smp_processor_id() in preemptible [00000001] code: modprobe/1529
> caller is ip_conntrack_helper_register+0x18/0x170

You need to disable CONFIG_NETFILTER_DEBUG or apply this patch.
Avoid smp_processor_id() in premptible code in the netfilter lock debugging
code.

Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

include/linux/netfilter_ipv4/lockhelp.h | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)

diff -puN include/linux/netfilter_ipv4/lockhelp.h~netfilter-debug-locking-fix include/linux/netfilter_ipv4/lockhelp.h
--- 25/include/linux/netfilter_ipv4/lockhelp.h~netfilter-debug-locking-fix Thu Apr 28 20:53:26 2005
+++ 25-akpm/include/linux/netfilter_ipv4/lockhelp.h Thu Apr 28 20:53:26 2005
@@ -63,9 +63,11 @@ do { if ((l)->read_locked_map & (1UL <<

#define LOCK_BH(lk) \
do { \
+ preempt_disable(); \
MUST_BE_UNLOCKED(lk); \
spin_lock_bh(&(lk)->l); \
atomic_set(&(lk)->locked_by, smp_processor_id()); \
+ preempt_enable(); \
} while(0)

#define UNLOCK_BH(lk) \
@@ -77,16 +79,20 @@ do { \

#define READ_LOCK(lk) \
do { \
+ preempt_disable(); \
MUST_BE_READ_WRITE_UNLOCKED(lk); \
read_lock_bh(&(lk)->l); \
set_bit(smp_processor_id(), &(lk)->read_locked_map); \
+ preempt_enable(); \
} while(0)

-#define WRITE_LOCK(lk) \
-do { \
- MUST_BE_READ_WRITE_UNLOCKED(lk); \
- write_lock_bh(&(lk)->l); \
- set_bit(smp_processor_id(), &(lk)->write_locked_map); \
+#define WRITE_LOCK(lk) \
+do { \
+ preempt_disable(); \
+ MUST_BE_READ_WRITE_UNLOCKED(lk); \
+ write_lock_bh(&(lk)->l); \
+ set_bit(smp_processor_id(), &(lk)->write_locked_map); \
+ preempt_enable(); \
} while(0)

#define READ_UNLOCK(lk) \