aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index ee90d74d7516..46b6ed534ef2 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -41,6 +41,7 @@
41#include "link.h" 41#include "link.h"
42#include "name_distr.h" 42#include "name_distr.h"
43#include "socket.h" 43#include "socket.h"
44#include "bcast.h"
44 45
45#define SS_LISTENING -1 /* socket is listening */ 46#define SS_LISTENING -1 /* socket is listening */
46#define SS_READY -2 /* socket is connectionless */ 47#define SS_READY -2 /* socket is connectionless */
@@ -342,7 +343,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock,
342 } 343 }
343 344
344 /* Allocate socket's protocol area */ 345 /* Allocate socket's protocol area */
345 sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto); 346 sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto, kern);
346 if (sk == NULL) 347 if (sk == NULL)
347 return -ENOMEM; 348 return -ENOMEM;
348 349
@@ -409,7 +410,7 @@ static int tipc_release(struct socket *sock)
409 struct net *net; 410 struct net *net;
410 struct tipc_sock *tsk; 411 struct tipc_sock *tsk;
411 struct sk_buff *skb; 412 struct sk_buff *skb;
412 u32 dnode, probing_state; 413 u32 dnode;
413 414
414 /* 415 /*
415 * Exit if socket isn't fully initialized (occurs when a failed accept() 416 * Exit if socket isn't fully initialized (occurs when a failed accept()
@@ -447,10 +448,7 @@ static int tipc_release(struct socket *sock)
447 } 448 }
448 449
449 tipc_sk_withdraw(tsk, 0, NULL); 450 tipc_sk_withdraw(tsk, 0, NULL);
450 probing_state = tsk->probing_state; 451 sk_stop_timer(sk, &sk->sk_timer);
451 if (del_timer_sync(&sk->sk_timer) &&
452 probing_state != TIPC_CONN_PROBING)
453 sock_put(sk);
454 tipc_sk_remove(tsk); 452 tipc_sk_remove(tsk);
455 if (tsk->connected) { 453 if (tsk->connected) {
456 skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, 454 skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE,
@@ -1764,13 +1762,14 @@ static int tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk,
1764int tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq) 1762int tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq)
1765{ 1763{
1766 u32 dnode, dport = 0; 1764 u32 dnode, dport = 0;
1767 int err = -TIPC_ERR_NO_PORT; 1765 int err;
1768 struct sk_buff *skb; 1766 struct sk_buff *skb;
1769 struct tipc_sock *tsk; 1767 struct tipc_sock *tsk;
1770 struct tipc_net *tn; 1768 struct tipc_net *tn;
1771 struct sock *sk; 1769 struct sock *sk;
1772 1770
1773 while (skb_queue_len(inputq)) { 1771 while (skb_queue_len(inputq)) {
1772 err = -TIPC_ERR_NO_PORT;
1774 skb = NULL; 1773 skb = NULL;
1775 dport = tipc_skb_peek_port(inputq, dport); 1774 dport = tipc_skb_peek_port(inputq, dport);
1776 tsk = tipc_sk_lookup(net, dport); 1775 tsk = tipc_sk_lookup(net, dport);
@@ -2141,11 +2140,17 @@ static void tipc_sk_timeout(unsigned long data)
2141 peer_node = tsk_peer_node(tsk); 2140 peer_node = tsk_peer_node(tsk);
2142 2141
2143 if (tsk->probing_state == TIPC_CONN_PROBING) { 2142 if (tsk->probing_state == TIPC_CONN_PROBING) {
2144 /* Previous probe not answered -> self abort */ 2143 if (!sock_owned_by_user(sk)) {
2145 skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, 2144 sk->sk_socket->state = SS_DISCONNECTING;
2146 TIPC_CONN_MSG, SHORT_H_SIZE, 0, 2145 tsk->connected = 0;
2147 own_node, peer_node, tsk->portid, 2146 tipc_node_remove_conn(sock_net(sk), tsk_peer_node(tsk),
2148 peer_port, TIPC_ERR_NO_PORT); 2147 tsk_peer_port(tsk));
2148 sk->sk_state_change(sk);
2149 } else {
2150 /* Try again later */
2151 sk_reset_timer(sk, &sk->sk_timer, (HZ / 20));
2152 }
2153
2149 } else { 2154 } else {
2150 skb = tipc_msg_create(CONN_MANAGER, CONN_PROBE, 2155 skb = tipc_msg_create(CONN_MANAGER, CONN_PROBE,
2151 INT_H_SIZE, 0, peer_node, own_node, 2156 INT_H_SIZE, 0, peer_node, own_node,