Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1084733pxk; Fri, 25 Sep 2020 05:59:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4NZN4JAnYMbv92gUt18dQBE757xWZAdFAFRfX6kBGZ5iwitVr8QBVTFACOKj8j29HVJTh X-Received: by 2002:a50:a6c2:: with SMTP id f2mr1168634edc.227.1601038780529; Fri, 25 Sep 2020 05:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601038780; cv=none; d=google.com; s=arc-20160816; b=PUtuEZyEc3pStuj2PWlR5dWex9/a6ZN2OBX2EoKbSrW+TWRJ2arO8iMHnl6lXRDYIR 3U+A1HxjDgxXlykzOqxIMX4bvTEjb1EVJCw2Ga66fexXSF89o/IH19+2Am/uT3S7hcHC Ny5gLTh13MkTQzy2uKF5RnyVYeQFzFliwzBZqaNXokG+YxNVMC3hTyQO+AWQ4DMu84k2 TdZ1a1ACFnuYHOpPUv6/V2gbGJ8cAMuprABrwKqljs1LlDmYt78QJzTccBrFWVFuCZ2B pAIdPP9TKbFMMAoAvOv7iWNnOw34u3kpwUT47N6wOXKGo85Pvl7xENw+I9rs/iuDIV87 BU4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JV2JloIkTQNPJVhB1Mq4vd93CwIFFuoFHy+tghDfRuw=; b=HR7TU7CQenHszR+jMUNwYFRwvZ2YkwDWAm60XW8TX0+dCCmTPZ5dT+mHI5E6ylc+j3 tPgObV9YBrRI87EJCL4ZLCW3+93Jo9Rq5lQHPLxKdkNgmZbwCVuYMez2MQeaFZkCZwAO Ocrejy7hMc49eHArG/HK64zVnhRxXN76KGlEr0XHg/SwhxqHGFxhPfnkvor5KXsXHNoo yqJKKvjyUeYJxX4LBIfM/ViVaNR4t08qFSVfHsfPLc4nBYDeNU5GB635yK5aBeS3hJdk 9AXRDPPyikoDovkE+722bxcEhehj6tie+dGwXlpD9xpnA91GZIqm7SJ0wa1N3B+jX818 //Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MPODrh41; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si1828220edp.213.2020.09.25.05.59.17; Fri, 25 Sep 2020 05:59:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MPODrh41; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729291AbgIYMzU (ORCPT + 99 others); Fri, 25 Sep 2020 08:55:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:34572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729649AbgIYMzN (ORCPT ); Fri, 25 Sep 2020 08:55:13 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 2F3102072E; Fri, 25 Sep 2020 12:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038511; bh=Fn8q7WjaJvgAR/AOi9VIFWdaDJNSyqRfQ3udDJ/me28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MPODrh41rMYP9nQGvPmPSco5bP22h0YG2Of5KxeuEC8p7wewZ9cZ5hfXv+eQtfDBw hdMo4sYk9yFLk/1ULHV7QC6J/xUFgzYpJo4D2Hw11HcKAiqNifESKkUKk7e+Q3plcW Wls18xK84cGo9lMNX/HNQ5o6t01LHsdfOivSqiaQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tetsuo Handa , Ying Xue , "David S. Miller" Subject: [PATCH 4.19 16/37] tipc: fix shutdown() of connection oriented socket Date: Fri, 25 Sep 2020 14:48:44 +0200 Message-Id: <20200925124723.385163668@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200925124720.972208530@linuxfoundation.org> References: <20200925124720.972208530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tetsuo Handa [ Upstream commit a4b5cc9e10803ecba64a7d54c0f47e4564b4a980 ] I confirmed that the problem fixed by commit 2a63866c8b51a3f7 ("tipc: fix shutdown() of connectionless socket") also applies to stream socket. ---------- #include #include #include int main(int argc, char *argv[]) { int fds[2] = { -1, -1 }; socketpair(PF_TIPC, SOCK_STREAM /* or SOCK_DGRAM */, 0, fds); if (fork() == 0) _exit(read(fds[0], NULL, 1)); shutdown(fds[0], SHUT_RDWR); /* This must make read() return. */ wait(NULL); /* To be woken up by _exit(). */ return 0; } ---------- Since shutdown(SHUT_RDWR) should affect all processes sharing that socket, unconditionally setting sk->sk_shutdown to SHUTDOWN_MASK will be the right behavior. Signed-off-by: Tetsuo Handa Acked-by: Ying Xue Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tipc/socket.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -2565,10 +2565,7 @@ static int tipc_shutdown(struct socket * lock_sock(sk); __tipc_shutdown(sock, TIPC_CONN_SHUTDOWN); - if (tipc_sk_type_connectionless(sk)) - sk->sk_shutdown = SHUTDOWN_MASK; - else - sk->sk_shutdown = SEND_SHUTDOWN; + sk->sk_shutdown = SHUTDOWN_MASK; if (sk->sk_state == TIPC_DISCONNECTING) { /* Discard any unreceived messages */