aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorCong Wang <[email protected]>2018-09-04 02:12:41 +0000
committerDavid S. Miller <[email protected]>2018-09-06 05:14:00 +0000
commit0a3b8b2b215f9e84b82ae97df71292ccfd92b1e7 (patch)
tree8dcd50c6f0a21d53352fc53dc828ebb8a180dc27 /net/tipc/socket.c
parentnet: qca_spi: Fix race condition in spi transfers (diff)
downloadkernel-0a3b8b2b215f9e84b82ae97df71292ccfd92b1e7.tar.gz
kernel-0a3b8b2b215f9e84b82ae97df71292ccfd92b1e7.zip
tipc: orphan sock in tipc_release()
Before we unlock the sock in tipc_release(), we have to detach sk->sk_socket from sk, otherwise a parallel tipc_sk_fill_sock_diag() could stil read it after we free this socket. Fixes: c30b70deb5f4 ("tipc: implement socket diagnostics for AF_TIPC") Reported-and-tested-by: [email protected] Cc: Jon Maloy <[email protected]> Cc: Ying Xue <[email protected]> Signed-off-by: Cong Wang <[email protected]> Acked-by: Ying Xue <[email protected]> Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index ab7a2a7178f7..a0ff8bffc96b 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -576,6 +576,7 @@ static int tipc_release(struct socket *sock)
sk_stop_timer(sk, &sk->sk_timer);
tipc_sk_remove(tsk);
+ sock_orphan(sk);
/* Reject any messages that accumulated in backlog queue */
release_sock(sk);
tipc_dest_list_purge(&tsk->cong_links);