Message ID | 20210616144715.3701428-1-eric.dumazet@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] net/af_unix: fix a data-race in unix_dgram_sendmsg / unix_release_sock | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 6 maintainers not CCed: gustavoars@kernel.org jingxiangfeng@huawei.com orcohen2006@gmail.com jamorris@linux.microsoft.com mkl@pengutronix.de christian.brauner@ubuntu.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 4 this patch: 4 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: Possible repeated word: 'Google' |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 4 this patch: 4 |
netdev/header_inline | success | Link |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 5a31307ceb76df1cf699b161963b92e06300aa2b..5d1192ceb13973ee74cc0f208fb91a36adabc643 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -535,11 +535,13 @@ static void unix_release_sock(struct sock *sk, int embrion) u->path.mnt = NULL; state = sk->sk_state; sk->sk_state = TCP_CLOSE; - unix_state_unlock(sk); - - wake_up_interruptible_all(&u->peer_wait); skpair = unix_peer(sk); + unix_peer(sk) = NULL; + + unix_state_unlock(sk); + + wake_up_interruptible_all(&u->peer_wait); if (skpair != NULL) { if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) { @@ -555,7 +557,6 @@ static void unix_release_sock(struct sock *sk, int embrion) unix_dgram_peer_wake_disconnect(sk, skpair); sock_put(skpair); /* It may now die */ - unix_peer(sk) = NULL; } /* Try to flush out this socket. Throw out buffers at least */