Skip to contentSkip to conversation

tipc: fix hanging poll() for stream sockets

PATCH In review Parthasarathy Bhuvaragan 2 participants 2 messages Dec 28, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tipc: fix hanging poll() for stream sockets

In commit 42b531de17d2f6 ("tipc: Fix missing connection request handling"), we replaced unconditional wakeup() with condtional wakeup for clients with flags POLLIN | POLLRDNORM | POLLRDBAND.

This breaks the applications which do a connect followed by poll with POLLOUT flag. These applications are not woken when the connection is ESTABLISHED and hence sleep forever.

In this commit, we fix it by including the POLLOUT event for sockets in TIPC_CONNECTING state.

Fixes 42b531de17d2f6 ("tipc: Fix missing connection request handling")
---
 net/tipc/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/tipc/socket.c +1 -1
index 41127d0b925e..3b4084480377 100644
@@ -727,11 +727,11 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock,
 
 	switch (sk->sk_state) {
 	case TIPC_ESTABLISHED:
+	case TIPC_CONNECTING:
 		if (!tsk->cong_link_cnt && !tsk_conn_cong(tsk))
 			revents |= POLLOUT;
 		/* fall thru' */
 	case TIPC_LISTEN:
-	case TIPC_CONNECTING:
 		if (!skb_queue_empty(&sk->sk_receive_queue))
 			revents |= POLLIN | POLLRDNORM;
 		break;
Signature · 1 line
2.11.0
maintainer
#1 lore raw

From: Parthasarathy Bhuvaragan <[email protected]>
Date: Thu, 28 Dec 2017 12:03:06 +0100

Quoted 8 lines

In commit 42b531de17d2f6 ("tipc: Fix missing connection request handling"), we replaced unconditional wakeup() with condtional wakeup for clients with flags POLLIN | POLLRDNORM | POLLRDBAND.

This breaks the applications which do a connect followed by poll with POLLOUT flag. These applications are not woken when the connection is ESTABLISHED and hence sleep forever.

Quoted 6 lines

In this commit, we fix it by including the POLLOUT event for sockets in TIPC_CONNECTING state.

Fixes 42b531de17d2f6 ("tipc: Fix missing connection request handling")

Applied and queued up for -stable.