Re: [GIT]: Networking

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Miller
Date: Tuesday, June 16, 2009 - 3:47 am

From: Ingo Molnar <mingo@elte.hu>
Date: Tue, 16 Jun 2009 11:15:38 +0200


Please give this patch a try.

diff --git a/include/net/x25.h b/include/net/x25.h
index fc3f03d..2cda040 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -187,7 +187,7 @@ extern int  x25_addr_ntoa(unsigned char *, struct x25_address *,
 extern int  x25_addr_aton(unsigned char *, struct x25_address *,
 			  struct x25_address *);
 extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *);
-extern void x25_destroy_socket(struct sock *);
+extern void x25_destroy_socket_from_timer(struct sock *);
 extern int  x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int);
 extern void x25_kill_by_neigh(struct x25_neigh *);
 
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index ed80af8..c51f309 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -332,14 +332,14 @@ static unsigned int x25_new_lci(struct x25_neigh *nb)
 /*
  *	Deferred destroy.
  */
-void x25_destroy_socket(struct sock *);
+static void __x25_destroy_socket(struct sock *);
 
 /*
  *	handler for deferred kills.
  */
 static void x25_destroy_timer(unsigned long data)
 {
-	x25_destroy_socket((struct sock *)data);
+	x25_destroy_socket_from_timer((struct sock *)data);
 }
 
 /*
@@ -349,12 +349,10 @@ static void x25_destroy_timer(unsigned long data)
  *	will touch it and we are (fairly 8-) ) safe.
  *	Not static as it's used by the timer
  */
-void x25_destroy_socket(struct sock *sk)
+static void __x25_destroy_socket(struct sock *sk)
 {
 	struct sk_buff *skb;
 
-	sock_hold(sk);
-	lock_sock(sk);
 	x25_stop_heartbeat(sk);
 	x25_stop_timer(sk);
 
@@ -385,7 +383,22 @@ void x25_destroy_socket(struct sock *sk)
 		/* drop last reference so sock_put will free */
 		__sock_put(sk);
 	}
+}
 
+void x25_destroy_socket_from_timer(struct sock *sk)
+{
+	sock_hold(sk);
+	bh_lock_sock(sk);
+	__x25_destroy_socket(sk);
+	bh_unlock_sock(sk);
+	sock_put(sk);
+}
+
+static void x25_destroy_socket(struct sock *sk)
+{
+	sock_hold(sk);
+	lock_sock(sk);
+	__x25_destroy_socket(sk);
 	release_sock(sk);
 	sock_put(sk);
 }
diff --git a/net/x25/x25_timer.c b/net/x25/x25_timer.c
index d3e3e54..5c5db1a 100644
--- a/net/x25/x25_timer.c
+++ b/net/x25/x25_timer.c
@@ -113,7 +113,7 @@ static void x25_heartbeat_expiry(unsigned long param)
 			    (sk->sk_state == TCP_LISTEN &&
 			     sock_flag(sk, SOCK_DEAD))) {
 				bh_unlock_sock(sk);
-				x25_destroy_socket(sk);
+				x25_destroy_socket_from_timer(sk);
 				return;
 			}
 			break;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT]: Networking, David Miller, (Mon Jun 15, 5:04 am)
Re: [GIT]: Networking, Ingo Molnar, (Tue Jun 16, 2:15 am)
Re: [GIT]: Networking, David Miller, (Tue Jun 16, 2:19 am)
Re: [GIT]: Networking, David Miller, (Tue Jun 16, 2:21 am)
Re: [GIT]: Networking, Ingo Molnar, (Tue Jun 16, 2:26 am)
Re: [GIT]: Networking, Ingo Molnar, (Tue Jun 16, 2:33 am)
Re: [GIT]: Networking, Alan Cox, (Tue Jun 16, 2:44 am)
Re: [GIT]: Networking, Ingo Molnar, (Tue Jun 16, 2:44 am)
Re: [GIT]: Networking, Ingo Molnar, (Tue Jun 16, 2:48 am)
Re: [GIT]: Networking, David Miller, (Tue Jun 16, 2:56 am)
Re: [GIT]: Networking, Ingo Molnar, (Tue Jun 16, 3:11 am)
Re: [GIT]: Networking, David Miller, (Tue Jun 16, 3:35 am)
Re: [GIT]: Networking, David Miller, (Tue Jun 16, 3:47 am)
Re: [GIT]: Networking, Ingo Molnar, (Tue Jun 16, 3:53 am)
Re: [GIT]: Networking, Ingo Molnar, (Tue Jun 16, 5:24 am)
Re: [GIT]: Networking, David Miller, (Tue Jun 16, 5:39 am)
Re: [GIT]: Networking, Eric Dumazet, (Tue Jun 16, 6:38 am)
Re: [GIT]: Networking, Eric Dumazet, (Tue Jun 16, 7:19 am)
Re: [GIT]: Networking, Linus Torvalds, (Tue Jun 16, 11:59 am)
Re: [GIT]: Networking, David Miller, (Tue Jun 16, 12:08 pm)
Re: [GIT]: Networking, Eric Dumazet, (Tue Jun 16, 12:37 pm)
Re: [GIT]: Networking, Eric Dumazet, (Tue Jun 16, 1:12 pm)
[PATCH] net: correct off-by-one write allocations reports, Eric Dumazet, (Tue Jun 16, 11:41 pm)
[PATCH] atm: sk_wmem_alloc initial value is one, Eric Dumazet, (Wed Jun 17, 4:31 am)
Re: [GIT]: Networking, David Miller, (Wed Jun 17, 4:32 am)
Re: [PATCH] atm: sk_wmem_alloc initial value is one, David Miller, (Wed Jun 17, 7:06 pm)
Re: [bug] __nf_ct_refresh_acct(): WARNING: at lib/list_deb ..., Pablo Neira Ayuso, (Thu Jun 18, 9:13 am)
[PATCH] netfilter: conntrack: death_by_timeout() fix, Eric Dumazet, (Thu Jun 18, 3:46 pm)
Re: [GIT]: Networking, Tilman Schmidt, (Thu Jun 18, 4:18 pm)
Re: [GIT]: Networking, David Miller, (Thu Jun 18, 8:36 pm)
Re: [PATCH] netfilter: conntrack: death_by_timeout() fix, Patrick McHardy, (Fri Jun 19, 4:15 am)