--- linux-2.6.9/net/bridge/netfilter/ebtables.c.old 2004-11-21 17:00:49.000000000 +0100 +++ linux-2.6.9/net/bridge/netfilter/ebtables.c 2004-11-21 17:15:05.000000000 +0100 @@ -971,11 +971,13 @@ static int do_replace(void __user *user, if (ret != 0) goto free_counterstmp; +printk("BEFORE DOWN MUTEX\n"); t = find_table_lock(tmp.name, &ret, &ebt_mutex); if (!t) { ret = -ENOENT; goto free_iterate; } +printk("INSIDE MUTEX PROTECTION\n"); /* the table doesn't like it */ if (t->check && (ret = t->check(newinfo, tmp.valid_hooks))) @@ -996,6 +998,7 @@ static int do_replace(void __user *user, } else if (table->nentries && !newinfo->nentries) module_put(t->me); /* we need an atomic snapshot of the counters */ +printk("EBTABLES: BEFORE WRITE LOCK\n"); write_lock_bh(&t->lock); if (tmp.num_counters) get_counters(t->private->counters, counterstmp, @@ -1003,7 +1006,9 @@ static int do_replace(void __user *user, t->private = newinfo; write_unlock_bh(&t->lock); +printk("EBTABLES: AFTER WRITE LOCK\n"); up(&ebt_mutex); +printk("EBTABLES: AFTER UP MUTEX\n"); /* so, a user can change the chains while having messed up her counter allocation. Only reason why this is done is because this way the lock is held only once, while this doesn't bring the kernel into a