Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-05-17 06:38:43 +0200
committerJiri Slaby <jslaby@suse.cz>2019-05-17 06:38:50 +0200
commitb62b00bfefc72308deda1a1dc3faf6155b511a87 (patch)
tree8e2d9298cae5004444747b987f9e7140ef1c9c77
parent5c31ec63bc2ebb68cef0a7264a5e712259ec3258 (diff)
tipc: fix hanging clients using poll with EPOLLOUT flag
-rw-r--r--patches.kernel.org/5.1.3-026-tipc-fix-hanging-clients-using-poll-with-EPOLLO.patch60
-rw-r--r--series.conf1
2 files changed, 61 insertions, 0 deletions
diff --git a/patches.kernel.org/5.1.3-026-tipc-fix-hanging-clients-using-poll-with-EPOLLO.patch b/patches.kernel.org/5.1.3-026-tipc-fix-hanging-clients-using-poll-with-EPOLLO.patch
new file mode 100644
index 0000000000..67aa475c33
--- /dev/null
+++ b/patches.kernel.org/5.1.3-026-tipc-fix-hanging-clients-using-poll-with-EPOLLO.patch
@@ -0,0 +1,60 @@
+From: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@gmail.com>
+Date: Thu, 9 May 2019 07:13:42 +0200
+Subject: [PATCH] tipc: fix hanging clients using poll with EPOLLOUT flag
+References: bnc#1012628
+Patch-mainline: 5.1.3
+Git-commit: ff946833b70e0c7f93de9a3f5b329b5ae2287b38
+
+[ Upstream commit ff946833b70e0c7f93de9a3f5b329b5ae2287b38 ]
+
+commit 517d7c79bdb398 ("tipc: fix hanging poll() for stream sockets")
+introduced a regression for clients using non-blocking sockets.
+After the commit, we send EPOLLOUT event to the client even in
+TIPC_CONNECTING state. This causes the subsequent send() to fail
+with ENOTCONN, as the socket is still not in TIPC_ESTABLISHED state.
+
+In this commit, we:
+- improve the fix for hanging poll() by replacing sk_data_ready()
+ with sk_state_change() to wake up all clients.
+- revert the faulty updates introduced by commit 517d7c79bdb398
+ ("tipc: fix hanging poll() for stream sockets").
+
+Fixes: 517d7c79bdb398 ("tipc: fix hanging poll() for stream sockets")
+Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@gmail.com>
+Acked-by: Jon Maloy <jon.maloy@ericsson.se>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ net/tipc/socket.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c
+index b542f14ed444..2851937f6e32 100644
+--- a/net/tipc/socket.c
++++ b/net/tipc/socket.c
+@@ -734,11 +734,11 @@ static __poll_t 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 |= EPOLLOUT;
+ /* fall through */
+ case TIPC_LISTEN:
++ case TIPC_CONNECTING:
+ if (!skb_queue_empty(&sk->sk_receive_queue))
+ revents |= EPOLLIN | EPOLLRDNORM;
+ break;
+@@ -2041,7 +2041,7 @@ static bool tipc_sk_filter_connect(struct tipc_sock *tsk, struct sk_buff *skb)
+ if (msg_data_sz(hdr))
+ return true;
+ /* Empty ACK-, - wake up sleeping connect() and drop */
+- sk->sk_data_ready(sk);
++ sk->sk_state_change(sk);
+ msg_set_dest_droppable(hdr, 1);
+ return false;
+ }
+--
+2.21.0
+
diff --git a/series.conf b/series.conf
index 9c6726a546..9a0fb79648 100644
--- a/series.conf
+++ b/series.conf
@@ -111,6 +111,7 @@
patches.kernel.org/5.1.3-023-net-ucc_geth-fix-Oops-when-changing-number-of-b.patch
patches.kernel.org/5.1.3-024-packet-Fix-error-path-in-packet_init.patch
patches.kernel.org/5.1.3-025-selinux-do-not-report-error-on-connect-AF_UNSPE.patch
+ patches.kernel.org/5.1.3-026-tipc-fix-hanging-clients-using-poll-with-EPOLLO.patch
########################################################
# Build fixes that apply to the vanilla kernel too.