|
@@ -1744,20 +1744,23 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
|
|
int chunk;
|
|
int chunk;
|
|
struct sk_buff *skb;
|
|
struct sk_buff *skb;
|
|
|
|
|
|
|
|
+ unix_state_lock(sk);
|
|
skb = skb_dequeue(&sk->sk_receive_queue);
|
|
skb = skb_dequeue(&sk->sk_receive_queue);
|
|
if (skb==NULL)
|
|
if (skb==NULL)
|
|
{
|
|
{
|
|
if (copied >= target)
|
|
if (copied >= target)
|
|
- break;
|
|
|
|
|
|
+ goto unlock;
|
|
|
|
|
|
/*
|
|
/*
|
|
* POSIX 1003.1g mandates this order.
|
|
* POSIX 1003.1g mandates this order.
|
|
*/
|
|
*/
|
|
|
|
|
|
if ((err = sock_error(sk)) != 0)
|
|
if ((err = sock_error(sk)) != 0)
|
|
- break;
|
|
|
|
|
|
+ goto unlock;
|
|
if (sk->sk_shutdown & RCV_SHUTDOWN)
|
|
if (sk->sk_shutdown & RCV_SHUTDOWN)
|
|
- break;
|
|
|
|
|
|
+ goto unlock;
|
|
|
|
+
|
|
|
|
+ unix_state_unlock(sk);
|
|
err = -EAGAIN;
|
|
err = -EAGAIN;
|
|
if (!timeo)
|
|
if (!timeo)
|
|
break;
|
|
break;
|
|
@@ -1771,7 +1774,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
|
|
}
|
|
}
|
|
mutex_lock(&u->readlock);
|
|
mutex_lock(&u->readlock);
|
|
continue;
|
|
continue;
|
|
|
|
+ unlock:
|
|
|
|
+ unix_state_unlock(sk);
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
+ unix_state_unlock(sk);
|
|
|
|
|
|
if (check_creds) {
|
|
if (check_creds) {
|
|
/* Never glue messages from different writers */
|
|
/* Never glue messages from different writers */
|