Skip to content

Commit 1586a58

Browse files
Eric Dumazetdavem330
authored andcommitted
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 <[email protected]> Reported-by: Alan Burlison <[email protected]> Tested-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 742e038 commit 1586a58

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/unix/af_unix.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,10 @@ static struct sock *unix_find_socket_byinode(struct inode *i)
326326
return s;
327327
}
328328

329-
static inline int unix_writable(struct sock *sk)
329+
static int unix_writable(const struct sock *sk)
330330
{
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;
332333
}
333334

334335
static void unix_write_space(struct sock *sk)

0 commit comments

Comments
 (0)