Skip to content

Commit

Permalink
net: Use RCU_INIT_POINTER() to set sk_wq
Browse files Browse the repository at this point in the history
This pointer is RCU protected, so proper primitives should be used.

Signed-off-by: Zhang Yu <[email protected]>
Signed-off-by: Li RongQing <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
lrq-max authored and davem330 committed Feb 24, 2019
1 parent b6a4119 commit c2f26e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
*/
sk_refcnt_debug_inc(newsk);
sk_set_socket(newsk, NULL);
newsk->sk_wq = NULL;
RCU_INIT_POINTER(newsk->sk_wq, NULL);

if (newsk->sk_prot->sockets_allocated)
sk_sockets_allocated_inc(newsk);
Expand Down Expand Up @@ -2828,11 +2828,11 @@ void sock_init_data(struct socket *sock, struct sock *sk)

if (sock) {
sk->sk_type = sock->type;
sk->sk_wq = sock->wq;
RCU_INIT_POINTER(sk->sk_wq, sock->wq);
sock->sk = sk;
sk->sk_uid = SOCK_INODE(sock)->i_uid;
} else {
sk->sk_wq = NULL;
RCU_INIT_POINTER(sk->sk_wq, NULL);
sk->sk_uid = make_kuid(sock_net(sk)->user_ns, 0);
}

Expand Down

0 comments on commit c2f26e8

Please sign in to comment.