netfilter fix (3/7): make iptables work on systems >32 cpus
PATCH 1/1 netfilter fix (3/7): make iptables work on systems >32 cpus
Hi Dave!
Here goes the third...
Author: Martin Hicks <[email protected]>
There are a bunch of (1<<smp_processor_id()) type shifts in lockhelp.h, which is safe for small processor machines, but breaks on larger ones.
include/linux/netfilter_ipv4/lockhelp.h +7 -7
@@ -42,22 +42,22 @@ printk("ASSERT %s:%u %s locked\n", __FILE__, __LINE__, #l); \ }while (0 ) -/* Write locked OK as well. */ \ +/* Write locked OK as well. */#define MUST_BE_READ_LOCKED (l) \ -do { if (!((l)->read_locked_map & (1 << smp_processor_id())) \ - && !((l)->write_locked_map & (1 << smp_processor_id()))) \ +do { if (!((l)->read_locked_map & (1UL << smp_processor_id())) \ + && !((l)->write_locked_map & (1UL << smp_processor_id()))) \ printk("ASSERT %s:%u %s not readlocked\n", __FILE__, __LINE__, #l); \ } while(0)#define MUST_BE_WRITE_LOCKED (l) \ -do { if (!((l)->write_locked_map & (1 << smp_processor_id()))) \ +do { if (!((l)->write_locked_map & (1UL << smp_processor_id()))) \ printk("ASSERT %s:%u %s not writelocked\n", __FILE__, __LINE__, #l); \ } while(0)#define MUST_BE_READ_WRITE_UNLOCKED (l) \ -do { if ((l)->read_locked_map & (1 << smp_processor_id())) \ +do { if ((l)->read_locked_map & (1UL << smp_processor_id())) \ printk("ASSERT %s:%u %s readlocked\n", __FILE__, __LINE__, #l); \ - else if ((l)->write_locked_map & (1 << smp_processor_id())) \ + else if ((l)->write_locked_map & (1UL << smp_processor_id())) \ printk("ASSERT %s:%u %s writelocked\n", __FILE__, __LINE__, #l); \ } while(0)
@@ -91,7 +91,7 @@#define READ_UNLOCK (lk) \ do { \ - if (!((lk)->read_locked_map & (1 << smp_processor_id()))) \ + if (!((lk)->read_locked_map & (1UL << smp_processor_id()))) \ printk("ASSERT: %s:%u %s not readlocked\n", \ __FILE__, __LINE__, #lk); \ clear_bit(smp_processor_id(), &(lk)->read_locked_map); \
Please apply, thanks.
Signature · 5 lines
- Harald Welte <[email protected]> http://www.netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie