diff options
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 3b61851bb927..5efdeef06f9d 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -239,7 +239,6 @@ static int tipc_sk_create(struct net *net, struct socket *sock, int protocol, | |||
239 | int tipc_sock_create_local(int type, struct socket **res) | 239 | int tipc_sock_create_local(int type, struct socket **res) |
240 | { | 240 | { |
241 | int rc; | 241 | int rc; |
242 | struct sock *sk; | ||
243 | 242 | ||
244 | rc = sock_create_lite(AF_TIPC, type, 0, res); | 243 | rc = sock_create_lite(AF_TIPC, type, 0, res); |
245 | if (rc < 0) { | 244 | if (rc < 0) { |
@@ -248,8 +247,6 @@ int tipc_sock_create_local(int type, struct socket **res) | |||
248 | } | 247 | } |
249 | tipc_sk_create(&init_net, *res, 0, 1); | 248 | tipc_sk_create(&init_net, *res, 0, 1); |
250 | 249 | ||
251 | sk = (*res)->sk; | ||
252 | |||
253 | return 0; | 250 | return 0; |
254 | } | 251 | } |
255 | 252 | ||
@@ -754,16 +751,11 @@ static int send_stream(struct kiocb *iocb, struct socket *sock, | |||
754 | 751 | ||
755 | /* Handle special cases where there is no connection */ | 752 | /* Handle special cases where there is no connection */ |
756 | if (unlikely(sock->state != SS_CONNECTED)) { | 753 | if (unlikely(sock->state != SS_CONNECTED)) { |
757 | if (sock->state == SS_UNCONNECTED) { | 754 | if (sock->state == SS_UNCONNECTED) |
758 | res = send_packet(NULL, sock, m, total_len); | 755 | res = send_packet(NULL, sock, m, total_len); |
759 | goto exit; | 756 | else |
760 | } else if (sock->state == SS_DISCONNECTING) { | 757 | res = sock->state == SS_DISCONNECTING ? -EPIPE : -ENOTCONN; |
761 | res = -EPIPE; | 758 | goto exit; |
762 | goto exit; | ||
763 | } else { | ||
764 | res = -ENOTCONN; | ||
765 | goto exit; | ||
766 | } | ||
767 | } | 759 | } |
768 | 760 | ||
769 | if (unlikely(m->msg_name)) { | 761 | if (unlikely(m->msg_name)) { |
@@ -1311,14 +1303,12 @@ static u32 filter_connect(struct tipc_sock *tsock, struct sk_buff **buf) | |||
1311 | static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *buf) | 1303 | static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *buf) |
1312 | { | 1304 | { |
1313 | struct tipc_msg *msg = buf_msg(buf); | 1305 | struct tipc_msg *msg = buf_msg(buf); |
1314 | unsigned int limit; | ||
1315 | 1306 | ||
1316 | if (msg_connected(msg)) | 1307 | if (msg_connected(msg)) |
1317 | limit = sysctl_tipc_rmem[2]; | 1308 | return sysctl_tipc_rmem[2]; |
1318 | else | 1309 | |
1319 | limit = sk->sk_rcvbuf >> TIPC_CRITICAL_IMPORTANCE << | 1310 | return sk->sk_rcvbuf >> TIPC_CRITICAL_IMPORTANCE << |
1320 | msg_importance(msg); | 1311 | msg_importance(msg); |
1321 | return limit; | ||
1322 | } | 1312 | } |
1323 | 1313 | ||
1324 | /** | 1314 | /** |
@@ -1514,14 +1504,12 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, | |||
1514 | sock->state != SS_CONNECTING, | 1504 | sock->state != SS_CONNECTING, |
1515 | timeout ? (long)msecs_to_jiffies(timeout) | 1505 | timeout ? (long)msecs_to_jiffies(timeout) |
1516 | : MAX_SCHEDULE_TIMEOUT); | 1506 | : MAX_SCHEDULE_TIMEOUT); |
1517 | lock_sock(sk); | ||
1518 | if (res <= 0) { | 1507 | if (res <= 0) { |
1519 | if (res == 0) | 1508 | if (res == 0) |
1520 | res = -ETIMEDOUT; | 1509 | res = -ETIMEDOUT; |
1521 | else | 1510 | return res; |
1522 | ; /* leave "res" unchanged */ | ||
1523 | goto exit; | ||
1524 | } | 1511 | } |
1512 | lock_sock(sk); | ||
1525 | } | 1513 | } |
1526 | 1514 | ||
1527 | if (unlikely(sock->state == SS_DISCONNECTING)) | 1515 | if (unlikely(sock->state == SS_DISCONNECTING)) |