Skip to contentSkip to conversation

[2.6.13] u32 fix.

PATCH Paweł Sikora 3 participants 4 messages Sep 16, 2005 – Sep 21, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

Could someone check and commit this lockhelp-fix?

Regards,
Paweł.

Signature · 3 lines
The only thing necessary for the triumph of evil
  is for good men to do nothing.
                                           - Edmund Burke
u32/linux-2.6/net/ipv4/netfilter/ipt_u32.c +5 -6
Index: patchlets/u32/linux-2.6/net/ipv4/netfilter/ipt_u32.c
===================================================================
@@ -105,7 +105,6 @@
 
 #include <linux/netfilter_ipv4/ipt_u32.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
-#include <linux/netfilter_ipv4/lockhelp.h>
 
 /* #include <asm-i386/timex.h> for timing */
 
@@ -115,7 +114,7 @@
 
 /* This is slow, but it's simple. --RR */
 static char u32_buffer[65536];
-static DECLARE_LOCK(u32_lock);
+static DEFINE_SPINLOCK(u32_lock);
 
 static int
 match(const struct sk_buff *skb,
@@ -136,7 +135,7 @@
 
 	u_int32_t AttPos;
 
-	LOCK_BH(&u32_lock);
+	spin_lock_bh(&u32_lock);
 
 	head = skb_header_pointer(skb, 0, skb->len, u32_buffer);
 	BUG_ON(head == NULL);
@@ -148,7 +147,7 @@
 	        AttPos = 0;
 		pos = data->tests[testind].location[0].number;
 		if (AttPos + pos + 3 > skb->len || AttPos + pos < 0){
-			UNLOCK_BH(&u32_lock);
+			spin_unlock_bh(&u32_lock);
 			return 0;
 		}
 		val = (base[pos]<<24) + (base[pos+1]<<16) +
@@ -190,13 +189,13 @@
 			/* cycles2 = get_cycles(); 
 			   printk("failed %d in %d cycles\n", testind, 
 				  cycles2-cycles1); */
-			UNLOCK_BH(&u32_lock);
+			spin_unlock_bh(&u32_lock);
 			return 0;
 		}
 	}
 	/* cycles2 = get_cycles();
 	   printk("succeeded in %d cycles\n", cycles2-cycles1); */
-	UNLOCK_BH(&u32_lock);
+	spin_unlock_bh(&u32_lock);
 	return 1;
 }
 
#3 lore raw
Quoted 5 lines · Patrick McHardy
Quoted 4 lines · Samir Bellabes
Quoted 1 line · Paweł Sikora

Could someone check and commit this lockhelp-fix?

Quoted 7 lines
Quoted 5 lines

it should be ok, as it's the same patch discussed here:
http://lists.netfilter.org/pipermail/netfilter-devel/2005-August/021158.html

Yours is better as it's against the svn tree, the mine is against a kernel tree.

Harald has now applied a similar patch, right?

Yes, it's revision 4265
thanks.