Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp469464yba; Wed, 15 May 2019 04:40:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDgusCXe/O3t1iHg4G8tXfIvSRYz0xPoAJnwXAamRvNZS8pTido2mMSPExbbYP+hzbOW0V X-Received: by 2002:a17:902:9048:: with SMTP id w8mr42734988plz.195.1557920451775; Wed, 15 May 2019 04:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557920451; cv=none; d=google.com; s=arc-20160816; b=QogFItANmAMkrug+U3CaTrBouO+jfFOrnctqpcqX0hn5blA/a8lDS6wsAu50hFcmZK UBSad6h/kLFA3kww0ZC34GhruqyQMEbYyPASZUK1dbdfeO8vJmkbGfbtmbFFLbtvrkwr o2oujTXpYTC8EZVIgh9o+d8q0748pMzX0sAv6DyV2fYaPo7+FzlBrorqgrnCQJFEcJp6 +j4y3bi0b2uxbXfY3Uwad9kPpAHUzkEjEl18kGRzO3SYxeDzb14JA0xklNZpNSClyQjc 8KC11CFbi3udcpQbcRheTGml0uig5ezndUXCD55nDc89saDIXKXX6brp4Nd7k0YuYjDv zeWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cBoCQ/yFtwJSaljUh9jLeCE9ErVGVMoPnDO47rZbiOM=; b=VE+NvgDT9kcZh/VaXHghkQGV9N9CI2K2ZhRNcTw3u/yx2fopjSRM53oI/tRvjqiJUo wPiofE2+kNYv5FSE00AA57nEpkMqOF1fW0MHGBV2FtILkE5QesZmqCfWSFLzVfjdbiWT b54jr7WkptbW+AJl/kn9ccvXqR0IV9wP/HranjriGx+LIe1B6sBWKqEUNiGvzpLOKd3E w1SSU6Tk8bbMnBFU9dcxYW8RT2zLzjie0IAEXMar2O6c70un0xN/pIu2k7DncP9NwG04 zPeo4chyb2QVf3OusDl9803hzwl2xJoz0rbL3MtuN5mxfNc4stma/07ASWzng0ru+pkI kY6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DRMfubO8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si1532863pge.123.2019.05.15.04.40.37; Wed, 15 May 2019 04:40:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DRMfubO8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731382AbfEOLim (ORCPT + 99 others); Wed, 15 May 2019 07:38:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:42552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732046AbfEOLaz (ORCPT ); Wed, 15 May 2019 07:30:55 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7F99C20843; Wed, 15 May 2019 11:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919855; bh=4KSBbtptG3jiW28pPbGqgjyq8g5hxBbZvktWcGJSOW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DRMfubO8lLi/4IjMNlOZyFJ53LDKAn1JqdFiKdYRDOjjfyAgu6ZvObm8SBukUOUKJ rE/PpxqnLiwvQ0iMTn5fSFtWUr8/JlFEKBXQfPixljaVKZz4BxF6n5NRttwyBj91lF Z/Ga5XISDSyFScxv/W+/zl+OY1ShsDS84vaHso0A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Parthasarathy Bhuvaragan , Jon Maloy , "David S. Miller" Subject: [PATCH 5.0 117/137] tipc: fix hanging clients using poll with EPOLLOUT flag Date: Wed, 15 May 2019 12:56:38 +0200 Message-Id: <20190515090702.138296556@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090651.633556783@linuxfoundation.org> References: <20190515090651.633556783@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Parthasarathy Bhuvaragan [ 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 Acked-by: Jon Maloy Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tipc/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -734,11 +734,11 @@ static __poll_t tipc_poll(struct file *f switch (sk->sk_state) { case TIPC_ESTABLISHED: - case TIPC_CONNECTING: if (!tsk->cong_link_cnt && !tsk_conn_cong(tsk)) revents |= EPOLLOUT; /* fall thru' */ 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(struc 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; }