diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2020-09-05 08:14:47 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-09-10 21:21:39 +0200 |
commit | a4b5cc9e10803ecba64a7d54c0f47e4564b4a980 (patch) | |
tree | d622d74128bbd4061c4beac5ab87457e86492920 /tools/vm | |
parent | connector: Move maintainence under networking drivers umbrella. (diff) | |
download | linux-a4b5cc9e10803ecba64a7d54c0f47e4564b4a980.tar.xz linux-a4b5cc9e10803ecba64a7d54c0f47e4564b4a980.zip |
tipc: fix shutdown() of connection oriented socket
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>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/vm')
0 files changed, 0 insertions, 0 deletions