diff options
-rw-r--r-- | include/net/x25.h | 2 | ||||
-rw-r--r-- | net/x25/af_x25.c | 23 | ||||
-rw-r--r-- | net/x25/x25_timer.c | 2 |
3 files changed, 20 insertions, 7 deletions
diff --git a/include/net/x25.h b/include/net/x25.h index fc3f03d976f8..2cda04011568 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 *, | |||
187 | extern int x25_addr_aton(unsigned char *, struct x25_address *, | 187 | extern int x25_addr_aton(unsigned char *, struct x25_address *, |
188 | struct x25_address *); | 188 | struct x25_address *); |
189 | extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *); | 189 | extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *); |
190 | extern void x25_destroy_socket(struct sock *); | 190 | extern void x25_destroy_socket_from_timer(struct sock *); |
191 | extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int); | 191 | extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int); |
192 | extern void x25_kill_by_neigh(struct x25_neigh *); | 192 | extern void x25_kill_by_neigh(struct x25_neigh *); |
193 | 193 | ||
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index ed80af8ca5fb..c51f3095739c 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) | |||
332 | /* | 332 | /* |
333 | * Deferred destroy. | 333 | * Deferred destroy. |
334 | */ | 334 | */ |
335 | void x25_destroy_socket(struct sock *); | 335 | static void __x25_destroy_socket(struct sock *); |
336 | 336 | ||
337 | /* | 337 | /* |
338 | * handler for deferred kills. | 338 | * handler for deferred kills. |
339 | */ | 339 | */ |
340 | static void x25_destroy_timer(unsigned long data) | 340 | static void x25_destroy_timer(unsigned long data) |
341 | { | 341 | { |
342 | x25_destroy_socket((struct sock *)data); | 342 | x25_destroy_socket_from_timer((struct sock *)data); |
343 | } | 343 | } |
344 | 344 | ||
345 | /* | 345 | /* |
@@ -349,12 +349,10 @@ static void x25_destroy_timer(unsigned long data) | |||
349 | * will touch it and we are (fairly 8-) ) safe. | 349 | * will touch it and we are (fairly 8-) ) safe. |
350 | * Not static as it's used by the timer | 350 | * Not static as it's used by the timer |
351 | */ | 351 | */ |
352 | void x25_destroy_socket(struct sock *sk) | 352 | static void __x25_destroy_socket(struct sock *sk) |
353 | { | 353 | { |
354 | struct sk_buff *skb; | 354 | struct sk_buff *skb; |
355 | 355 | ||
356 | sock_hold(sk); | ||
357 | lock_sock(sk); | ||
358 | x25_stop_heartbeat(sk); | 356 | x25_stop_heartbeat(sk); |
359 | x25_stop_timer(sk); | 357 | x25_stop_timer(sk); |
360 | 358 | ||
@@ -385,7 +383,22 @@ void x25_destroy_socket(struct sock *sk) | |||
385 | /* drop last reference so sock_put will free */ | 383 | /* drop last reference so sock_put will free */ |
386 | __sock_put(sk); | 384 | __sock_put(sk); |
387 | } | 385 | } |
386 | } | ||
388 | 387 | ||
388 | void x25_destroy_socket_from_timer(struct sock *sk) | ||
389 | { | ||
390 | sock_hold(sk); | ||
391 | bh_lock_sock(sk); | ||
392 | __x25_destroy_socket(sk); | ||
393 | bh_unlock_sock(sk); | ||
394 | sock_put(sk); | ||
395 | } | ||
396 | |||
397 | static void x25_destroy_socket(struct sock *sk) | ||
398 | { | ||
399 | sock_hold(sk); | ||
400 | lock_sock(sk); | ||
401 | __x25_destroy_socket(sk); | ||
389 | release_sock(sk); | 402 | release_sock(sk); |
390 | sock_put(sk); | 403 | sock_put(sk); |
391 | } | 404 | } |
diff --git a/net/x25/x25_timer.c b/net/x25/x25_timer.c index d3e3e54db936..5c5db1a36399 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) | |||
113 | (sk->sk_state == TCP_LISTEN && | 113 | (sk->sk_state == TCP_LISTEN && |
114 | sock_flag(sk, SOCK_DEAD))) { | 114 | sock_flag(sk, SOCK_DEAD))) { |
115 | bh_unlock_sock(sk); | 115 | bh_unlock_sock(sk); |
116 | x25_destroy_socket(sk); | 116 | x25_destroy_socket_from_timer(sk); |
117 | return; | 117 | return; |
118 | } | 118 | } |
119 | break; | 119 | break; |