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.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 32d778448a00..2a6a5a6b4c12 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2,7 +2,7 @@
2 * net/tipc/socket.c: TIPC socket API 2 * net/tipc/socket.c: TIPC socket API
3 * 3 *
4 * Copyright (c) 2001-2006, Ericsson AB 4 * Copyright (c) 2001-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -629,6 +629,9 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
629 return -ENOTCONN; 629 return -ENOTCONN;
630 } 630 }
631 631
632 if (unlikely(m->msg_name))
633 return -EISCONN;
634
632 /* 635 /*
633 * Send each iovec entry using one or more messages 636 * Send each iovec entry using one or more messages
634 * 637 *
@@ -641,6 +644,8 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
641 curr_iovlen = m->msg_iovlen; 644 curr_iovlen = m->msg_iovlen;
642 my_msg.msg_iov = &my_iov; 645 my_msg.msg_iov = &my_iov;
643 my_msg.msg_iovlen = 1; 646 my_msg.msg_iovlen = 1;
647 my_msg.msg_flags = m->msg_flags;
648 my_msg.msg_name = NULL;
644 bytes_sent = 0; 649 bytes_sent = 0;
645 650
646 while (curr_iovlen--) { 651 while (curr_iovlen--) {
@@ -941,7 +946,7 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock,
941 int sz_to_copy; 946 int sz_to_copy;
942 int sz_copied = 0; 947 int sz_copied = 0;
943 int needed; 948 int needed;
944 char *crs = m->msg_iov->iov_base; 949 char __user *crs = m->msg_iov->iov_base;
945 unsigned char *buf_crs; 950 unsigned char *buf_crs;
946 u32 err; 951 u32 err;
947 int res; 952 int res;
@@ -1203,7 +1208,8 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1203 atomic_inc(&tipc_queue_size); 1208 atomic_inc(&tipc_queue_size);
1204 skb_queue_tail(&sock->sk->sk_receive_queue, buf); 1209 skb_queue_tail(&sock->sk->sk_receive_queue, buf);
1205 1210
1206 wake_up_interruptible(sock->sk->sk_sleep); 1211 if (waitqueue_active(sock->sk->sk_sleep))
1212 wake_up_interruptible(sock->sk->sk_sleep);
1207 return TIPC_OK; 1213 return TIPC_OK;
1208} 1214}
1209 1215
@@ -1218,7 +1224,8 @@ static void wakeupdispatch(struct tipc_port *tport)
1218{ 1224{
1219 struct tipc_sock *tsock = (struct tipc_sock *)tport->usr_handle; 1225 struct tipc_sock *tsock = (struct tipc_sock *)tport->usr_handle;
1220 1226
1221 wake_up_interruptible(tsock->sk.sk_sleep); 1227 if (waitqueue_active(tsock->sk.sk_sleep))
1228 wake_up_interruptible(tsock->sk.sk_sleep);
1222} 1229}
1223 1230
1224/** 1231/**
@@ -1496,7 +1503,7 @@ static int setsockopt(struct socket *sock,
1496 return -ENOPROTOOPT; 1503 return -ENOPROTOOPT;
1497 if (ol < sizeof(value)) 1504 if (ol < sizeof(value))
1498 return -EINVAL; 1505 return -EINVAL;
1499 if ((res = get_user(value, (u32 *)ov))) 1506 if ((res = get_user(value, (u32 __user *)ov)))
1500 return res; 1507 return res;
1501 1508
1502 if (down_interruptible(&tsock->sem)) 1509 if (down_interruptible(&tsock->sem))
@@ -1541,7 +1548,7 @@ static int setsockopt(struct socket *sock,
1541 */ 1548 */
1542 1549
1543static int getsockopt(struct socket *sock, 1550static int getsockopt(struct socket *sock,
1544 int lvl, int opt, char __user *ov, int *ol) 1551 int lvl, int opt, char __user *ov, int __user *ol)
1545{ 1552{
1546 struct tipc_sock *tsock = tipc_sk(sock->sk); 1553 struct tipc_sock *tsock = tipc_sk(sock->sk);
1547 int len; 1554 int len;