diff --git a/net/smc/smc_inet.c b/net/smc/smc_inet.c index a5b20416..5e5abba 100644 --- a/net/smc/smc_inet.c +++ b/net/smc/smc_inet.c @@ -108,14 +108,29 @@ struct smc6_sock { }; #endif /* CONFIG_IPV6 */ +static struct lock_class_key smc_clcsk_slock_keys[2]; +static struct lock_class_key smc_clcsk_keys[2]; + static int smc_inet_init_sock(struct sock *sk) { + bool is_ipv6 = sk->sk_family == AF_INET6; struct net *net = sock_net(sk); + int rc; /* init common smc sock */ smc_sk_init(net, sk, IPPROTO_SMC); /* create clcsock */ - return smc_create_clcsk(net, sk, sk->sk_family); + rc = smc_create_clcsk(net, sk, sk->sk_family); + if (rc) + return rc; + + sock_lock_init_class_and_name(sk, + is_ipv6 ? "slock-AF_INET6-SMC-CLCSK" : "slock-AF_INET-SMC-CLCSK", + &smc_clcsk_slock_keys[is_ipv6], + is_ipv6 ? "sk_lock-AF_INET6-SMC-CLCSK" : "sk_lock-AF_INET-SMC-CLCSK", + &smc_clcsk_keys[is_ipv6]); + + return 0; } int __init smc_inet_init(void)