diff options
author | Eric Dumazet <edumazet@google.com> | 2015-10-23 13:59:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-25 09:37:45 -0400 |
commit | 1586a5877db9eee313379738d6581bc7c6ffb5e3 (patch) | |
tree | 67dfe980f1ce3a826883360f51babeabdb73c820 /net/unix | |
parent | 742e038330a485350334ee5eb75dce4a9dff87cd (diff) |
af_unix: do not report POLLOUT on listeners
poll(POLLOUT) on a listener should not report fd is ready for
a write().
This would break some applications using poll() and pfd.events = -1,
as they would not block in poll()
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Alan Burlison <Alan.Burlison@oracle.com>
Tested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix')
-rw-r--r-- | net/unix/af_unix.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 94f658235fb4..aaa0b58d6aba 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -326,9 +326,10 @@ found: | |||
326 | return s; | 326 | return s; |
327 | } | 327 | } |
328 | 328 | ||
329 | static inline int unix_writable(struct sock *sk) | 329 | static int unix_writable(const struct sock *sk) |
330 | { | 330 | { |
331 | return (atomic_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf; | 331 | return sk->sk_state != TCP_LISTEN && |
332 | (atomic_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf; | ||
332 | } | 333 | } |
333 | 334 | ||
334 | static void unix_write_space(struct sock *sk) | 335 | static void unix_write_space(struct sock *sk) |