diff options
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index d8d98d5b508..de870184e45 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1171,7 +1171,7 @@ restart: | |||
1171 | newsk->sk_type = sk->sk_type; | 1171 | newsk->sk_type = sk->sk_type; |
1172 | init_peercred(newsk); | 1172 | init_peercred(newsk); |
1173 | newu = unix_sk(newsk); | 1173 | newu = unix_sk(newsk); |
1174 | newsk->sk_wq = &newu->peer_wq; | 1174 | RCU_INIT_POINTER(newsk->sk_wq, &newu->peer_wq); |
1175 | otheru = unix_sk(other); | 1175 | otheru = unix_sk(other); |
1176 | 1176 | ||
1177 | /* copy address information from listening to new sock*/ | 1177 | /* copy address information from listening to new sock*/ |
@@ -1567,7 +1567,6 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1567 | struct sock_iocb *siocb = kiocb_to_siocb(kiocb); | 1567 | struct sock_iocb *siocb = kiocb_to_siocb(kiocb); |
1568 | struct sock *sk = sock->sk; | 1568 | struct sock *sk = sock->sk; |
1569 | struct sock *other = NULL; | 1569 | struct sock *other = NULL; |
1570 | struct sockaddr_un *sunaddr = msg->msg_name; | ||
1571 | int err, size; | 1570 | int err, size; |
1572 | struct sk_buff *skb; | 1571 | struct sk_buff *skb; |
1573 | int sent = 0; | 1572 | int sent = 0; |
@@ -1590,7 +1589,6 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1590 | err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP; | 1589 | err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP; |
1591 | goto out_err; | 1590 | goto out_err; |
1592 | } else { | 1591 | } else { |
1593 | sunaddr = NULL; | ||
1594 | err = -ENOTCONN; | 1592 | err = -ENOTCONN; |
1595 | other = unix_peer(sk); | 1593 | other = unix_peer(sk); |
1596 | if (!other) | 1594 | if (!other) |
@@ -1730,7 +1728,11 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1730 | 1728 | ||
1731 | msg->msg_namelen = 0; | 1729 | msg->msg_namelen = 0; |
1732 | 1730 | ||
1733 | mutex_lock(&u->readlock); | 1731 | err = mutex_lock_interruptible(&u->readlock); |
1732 | if (err) { | ||
1733 | err = sock_intr_errno(sock_rcvtimeo(sk, noblock)); | ||
1734 | goto out; | ||
1735 | } | ||
1734 | 1736 | ||
1735 | skb = skb_recv_datagram(sk, flags, noblock, &err); | 1737 | skb = skb_recv_datagram(sk, flags, noblock, &err); |
1736 | if (!skb) { | 1738 | if (!skb) { |
@@ -1870,7 +1872,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1870 | memset(&tmp_scm, 0, sizeof(tmp_scm)); | 1872 | memset(&tmp_scm, 0, sizeof(tmp_scm)); |
1871 | } | 1873 | } |
1872 | 1874 | ||
1873 | mutex_lock(&u->readlock); | 1875 | err = mutex_lock_interruptible(&u->readlock); |
1876 | if (err) { | ||
1877 | err = sock_intr_errno(timeo); | ||
1878 | goto out; | ||
1879 | } | ||
1874 | 1880 | ||
1875 | do { | 1881 | do { |
1876 | int chunk; | 1882 | int chunk; |
@@ -1901,11 +1907,12 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1901 | 1907 | ||
1902 | timeo = unix_stream_data_wait(sk, timeo); | 1908 | timeo = unix_stream_data_wait(sk, timeo); |
1903 | 1909 | ||
1904 | if (signal_pending(current)) { | 1910 | if (signal_pending(current) |
1911 | || mutex_lock_interruptible(&u->readlock)) { | ||
1905 | err = sock_intr_errno(timeo); | 1912 | err = sock_intr_errno(timeo); |
1906 | goto out; | 1913 | goto out; |
1907 | } | 1914 | } |
1908 | mutex_lock(&u->readlock); | 1915 | |
1909 | continue; | 1916 | continue; |
1910 | unlock: | 1917 | unlock: |
1911 | unix_state_unlock(sk); | 1918 | unix_state_unlock(sk); |