diff options
| author | Ingo Molnar <mingo@kernel.org> | 2016-03-08 12:26:07 +0100 | 
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2016-03-08 12:26:07 +0100 | 
| commit | fe36d8912c8e402c62ce5a8712b6a47baae1ceaa (patch) | |
| tree | f8394fd1dbb10b2d075e74d0f6b09ec29c795fe6 /net/unix/af_unix.c | |
| parent | 16a8083cedbe628228dbb08fc1469c70e6208619 (diff) | |
| parent | e2857b8f11a289ed2b61d18d0665e05c1053c446 (diff) | |
Merge branch 'linus' into irq/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 30 | 
1 files changed, 20 insertions, 10 deletions
| diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 49d5093eb055..f75f847e688d 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1496,7 +1496,7 @@ static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb)  	UNIXCB(skb).fp = NULL;  	for (i = scm->fp->count-1; i >= 0; i--) -		unix_notinflight(scm->fp->fp[i]); +		unix_notinflight(scm->fp->user, scm->fp->fp[i]);  }  static void unix_destruct_scm(struct sk_buff *skb) @@ -1561,7 +1561,7 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)  		return -ENOMEM;  	for (i = scm->fp->count - 1; i >= 0; i--) -		unix_inflight(scm->fp->fp[i]); +		unix_inflight(scm->fp->user, scm->fp->fp[i]);  	return max_level;  } @@ -1781,7 +1781,12 @@ restart_locked:  			goto out_unlock;  	} -	if (unlikely(unix_peer(other) != sk && unix_recvq_full(other))) { +	/* other == sk && unix_peer(other) != sk if +	 * - unix_peer(sk) == NULL, destination address bound to sk +	 * - unix_peer(sk) == sk by time of get but disconnected before lock +	 */ +	if (other != sk && +	    unlikely(unix_peer(other) != sk && unix_recvq_full(other))) {  		if (timeo) {  			timeo = unix_wait_for_peer(other, timeo); @@ -2277,13 +2282,15 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state)  	size_t size = state->size;  	unsigned int last_len; -	err = -EINVAL; -	if (sk->sk_state != TCP_ESTABLISHED) +	if (unlikely(sk->sk_state != TCP_ESTABLISHED)) { +		err = -EINVAL;  		goto out; +	} -	err = -EOPNOTSUPP; -	if (flags & MSG_OOB) +	if (unlikely(flags & MSG_OOB)) { +		err = -EOPNOTSUPP;  		goto out; +	}  	target = sock_rcvlowat(sk, flags & MSG_WAITALL, size);  	timeo = sock_rcvtimeo(sk, noblock); @@ -2305,6 +2312,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state)  		bool drop_skb;  		struct sk_buff *skb, *last; +redo:  		unix_state_lock(sk);  		if (sock_flag(sk, SOCK_DEAD)) {  			err = -ECONNRESET; @@ -2329,9 +2337,11 @@ again:  				goto unlock;  			unix_state_unlock(sk); -			err = -EAGAIN; -			if (!timeo) +			if (!timeo) { +				err = -EAGAIN;  				break; +			} +  			mutex_unlock(&u->readlock);  			timeo = unix_stream_data_wait(sk, timeo, last, @@ -2344,7 +2354,7 @@ again:  			}  			mutex_lock(&u->readlock); -			continue; +			goto redo;  unlock:  			unix_state_unlock(sk);  			break; | 
