Netdev Archive on lore.kernel.org help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org> To: Jon Maloy <jmaloy@redhat.com> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>, Ying Xue <ying.xue@windriver.com>, Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@gmail.com>, "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net Subject: Re: [PATCH] tipc: fix shutdown() of connection oriented socket Date: Sun, 6 Sep 2020 20:28:13 -0700 [thread overview] Message-ID: <20200906202813.759b1a09@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw) In-Reply-To: <20200905061447.3463-1-penguin-kernel@I-love.SAKURA.ne.jp> On Sat, 5 Sep 2020 15:14:47 +0900 Tetsuo Handa wrote: > I confirmed that the problem fixed by commit 2a63866c8b51a3f7 ("tipc: fix > shutdown() of connectionless socket") also applies to stream socket. > > ---------- > #include <sys/socket.h> > #include <unistd.h> > #include <sys/wait.h> > > 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 <penguin-kernel@I-love.SAKURA.ne.jp> Jon, this looks correct to me but it may change the behavior for applications (at least poll events). Please review. > diff --git a/net/tipc/socket.c b/net/tipc/socket.c > index ebd280e767bd..11b27ddc75ba 100644 > --- a/net/tipc/socket.c > +++ b/net/tipc/socket.c > @@ -2771,10 +2771,7 @@ static int tipc_shutdown(struct socket *sock, int how) > > trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " "); > __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 */
next prev parent reply other threads:[~2020-09-07 3:28 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-05 6:14 [PATCH] tipc: fix shutdown() of connection oriented socket Tetsuo Handa 2020-09-07 3:28 ` Jakub Kicinski [this message] 2020-09-08 16:11 ` Xue, Ying 2020-09-10 19:22 ` David Miller
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200906202813.759b1a09@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \ --to=kuba@kernel.org \ --cc=davem@davemloft.net \ --cc=jmaloy@redhat.com \ --cc=netdev@vger.kernel.org \ --cc=parthasarathy.bhuvaragan@gmail.com \ --cc=penguin-kernel@I-love.SAKURA.ne.jp \ --cc=tipc-discussion@lists.sourceforge.net \ --cc=ying.xue@windriver.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).