diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index e8898758dd316bffe435e8074607b140d746588c..7ff31c60186ab0ae0ff42f7d739894b38f6db8dc 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2091,6 +2091,10 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, return mask; } + /* No write status requested, avoid expensive OUT tests. */ + if (wait && !(wait->key & (POLLWRBAND | POLLWRNORM | POLLOUT))) + return mask; + writable = unix_writable(sk); other = unix_peer_get(sk); if (other) {