Skip to content

Commit

Permalink
af_unix: do not report POLLOUT on listeners
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Oct 25, 2015
1 parent 742e038 commit 1586a58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/unix/af_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,10 @@ static struct sock *unix_find_socket_byinode(struct inode *i)
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)
Expand Down

0 comments on commit 1586a58

Please sign in to comment.