diff options
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 17 | 
1 files changed, 10 insertions, 7 deletions
| diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index ef31b40ad550..aaa0b58d6aba 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -326,9 +326,10 @@ found:  	return s;  } -static inline int unix_writable(struct sock *sk) +static int unix_writable(const struct sock *sk)  { -	return (atomic_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf; +	return sk->sk_state != TCP_LISTEN && +	       (atomic_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf;  }  static void unix_write_space(struct sock *sk) @@ -2064,6 +2065,11 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state)  		goto out;  	} +	if (flags & MSG_PEEK) +		skip = sk_peek_offset(sk, flags); +	else +		skip = 0; +  	do {  		int chunk;  		struct sk_buff *skb, *last; @@ -2112,7 +2118,6 @@ unlock:  			break;  		} -		skip = sk_peek_offset(sk, flags);  		while (skip >= unix_skb_len(skb)) {  			skip -= unix_skb_len(skb);  			last = skb; @@ -2179,14 +2184,12 @@ unlock:  			if (UNIXCB(skb).fp)  				scm.fp = scm_fp_dup(UNIXCB(skb).fp); -			if (skip) { -				sk_peek_offset_fwd(sk, chunk); -				skip -= chunk; -			} +			sk_peek_offset_fwd(sk, chunk);  			if (UNIXCB(skb).fp)  				break; +			skip = 0;  			last = skb;  			last_len = skb->len;  			unix_state_lock(sk); | 
