netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix locking
@ 2003-09-06  0:26 Michael Rozhavsky
  2003-09-09  2:21 ` David S. Miller
  2003-09-11 23:49 ` David S. Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Rozhavsky @ 2003-09-06  0:26 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 77 bytes --]

Hi,

I've found two problems with locking in networking code.

--

	Michael


[-- Attachment #2: tcp_ipv4.c.diff --]
[-- Type: text/plain, Size: 390 bytes --]

--- ../../../linux-2.4.22/net/ipv4/tcp_ipv4.c	Mon Aug 25 04:44:44 2003
+++ tcp_ipv4.c	Fri Sep  5 16:56:54 2003
@@ -907,9 +907,9 @@
 	req->expires = jiffies + TCP_TIMEOUT_INIT;
 	req->retrans = 0;
 	req->sk = NULL;
-	req->dl_next = lopt->syn_table[h];
 
 	write_lock(&tp->syn_wait_lock);
+	req->dl_next = lopt->syn_table[h];
 	lopt->syn_table[h] = req;
 	write_unlock(&tp->syn_wait_lock);
 

[-- Attachment #3: sit.c.diff --]
[-- Type: text/plain, Size: 656 bytes --]

--- sit.c.orig	Fri Sep  5 17:07:55 2003
+++ sit.c	Fri Sep  5 17:08:37 2003
@@ -125,14 +125,14 @@
 {
 	struct ip_tunnel **tp;
 
+	write_lock_bh(&ipip6_lock);
 	for (tp = ipip6_bucket(t); *tp; tp = &(*tp)->next) {
 		if (t == *tp) {
-			write_lock_bh(&ipip6_lock);
 			*tp = t->next;
-			write_unlock_bh(&ipip6_lock);
 			break;
 		}
 	}
+	write_unlock_bh(&ipip6_lock);
 }
 
 static void ipip6_tunnel_link(struct ip_tunnel *t)
@@ -141,8 +141,8 @@
 
 	write_lock_bh(&ipip6_lock);
 	t->next = *tp;
-	write_unlock_bh(&ipip6_lock);
 	*tp = t;
+	write_unlock_bh(&ipip6_lock);
 }
 
 struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int create)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-09-11 23:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-06  0:26 [PATCH] fix locking Michael Rozhavsky
2003-09-09  2:21 ` David S. Miller
2003-09-11 23:49 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).