net/core: move the lockdep-init of sk_callback_lock to sk_init_common()
In commit cdfbabfb2f0c ("net: Work around lockdep limitation in sockets that use sockets"), it introduces 'af_kern_callback_keys' to lockdep-init of sk_callback_lock according to 'sk_kern_sock', it modifies sock_init_data() only, and sk_clone_lock() calls sk_init_common() to initialize sk_callback_lock too, so the lockdep-init of sk_callback_lock should be moved to sk_init_common(). Signed-off-by: Gou Hao <gouhao@uniontech.com> Link: https://lore.kernel.org/r/20240526145718.9542-2-gouhao@uniontech.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
c65b652111
commit
de31e96cf4
@ -2262,7 +2262,12 @@ static void sk_init_common(struct sock *sk)
|
|||||||
lockdep_set_class_and_name(&sk->sk_error_queue.lock,
|
lockdep_set_class_and_name(&sk->sk_error_queue.lock,
|
||||||
af_elock_keys + sk->sk_family,
|
af_elock_keys + sk->sk_family,
|
||||||
af_family_elock_key_strings[sk->sk_family]);
|
af_family_elock_key_strings[sk->sk_family]);
|
||||||
lockdep_set_class_and_name(&sk->sk_callback_lock,
|
if (sk->sk_kern_sock)
|
||||||
|
lockdep_set_class_and_name(&sk->sk_callback_lock,
|
||||||
|
af_kern_callback_keys + sk->sk_family,
|
||||||
|
af_family_kern_clock_key_strings[sk->sk_family]);
|
||||||
|
else
|
||||||
|
lockdep_set_class_and_name(&sk->sk_callback_lock,
|
||||||
af_callback_keys + sk->sk_family,
|
af_callback_keys + sk->sk_family,
|
||||||
af_family_clock_key_strings[sk->sk_family]);
|
af_family_clock_key_strings[sk->sk_family]);
|
||||||
}
|
}
|
||||||
@ -3460,17 +3465,6 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid)
|
|||||||
}
|
}
|
||||||
sk->sk_uid = uid;
|
sk->sk_uid = uid;
|
||||||
|
|
||||||
if (sk->sk_kern_sock)
|
|
||||||
lockdep_set_class_and_name(
|
|
||||||
&sk->sk_callback_lock,
|
|
||||||
af_kern_callback_keys + sk->sk_family,
|
|
||||||
af_family_kern_clock_key_strings[sk->sk_family]);
|
|
||||||
else
|
|
||||||
lockdep_set_class_and_name(
|
|
||||||
&sk->sk_callback_lock,
|
|
||||||
af_callback_keys + sk->sk_family,
|
|
||||||
af_family_clock_key_strings[sk->sk_family]);
|
|
||||||
|
|
||||||
sk->sk_state_change = sock_def_wakeup;
|
sk->sk_state_change = sock_def_wakeup;
|
||||||
sk->sk_data_ready = sock_def_readable;
|
sk->sk_data_ready = sock_def_readable;
|
||||||
sk->sk_write_space = sock_def_write_space;
|
sk->sk_write_space = sock_def_write_space;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user