[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1445623156.22974.186.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Fri, 23 Oct 2015 10:59:16 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Alan Burlison <Alan.Burlison@...cle.com>,
David Miller <davem@...emloft.net>
Cc: Casper.Dik@...cle.com, Al Viro <viro@...IV.linux.org.uk>,
David Miller <davem@...emloft.net>, stephen@...workplumber.org,
netdev@...r.kernel.org, dholland-tech@...bsd.org
Subject: [PATCH net-next] af_unix: do not report POLLOUT on listeners
From: Eric Dumazet <edumazet@...gle.com>
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@...gle.com>
Reported-by: Alan Burlison <Alan.Burlison@...cle.com>
Tested-by: Eric Dumazet <edumazet@...gle.com>
---
net/unix/af_unix.c | 5 +++--
1 file 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:
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)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists