@@ -800,6 +800,7 @@ struct proto {
#ifdef SOCK_REFCNT_DEBUG
atomic_t socks;
#endif
+ struct lock_class_key *callback_key;
};
extern int proto_register(struct proto *prot, int alloc_slab);
@@ -1210,7 +1210,9 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
spin_lock_init(&newsk->sk_dst_lock);
rwlock_init(&newsk->sk_callback_lock);
lockdep_set_class_and_name(&newsk->sk_callback_lock,
- af_callback_keys + newsk->sk_family,
+ sk->sk_prot->callback_key ?
+ sk->sk_prot->callback_key :
+ af_callback_keys + newsk->sk_family,
af_family_clock_key_strings[newsk->sk_family]);
newsk->sk_dst_cache = NULL;
@@ -1965,6 +1967,9 @@ void sock_init_data(struct socket *sock, struct sock *sk)
spin_lock_init(&sk->sk_dst_lock);
rwlock_init(&sk->sk_callback_lock);
lockdep_set_class_and_name(&sk->sk_callback_lock,
+ sk->sk_prot->callback_key ?
+ sk->sk_prot->callback_key :
+ af_callback_keys + newsk->sk_family,
af_callback_keys + sk->sk_family,
af_family_clock_key_strings[sk->sk_family]);
@@ -1870,6 +1870,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
}
EXPORT_SYMBOL(udp_poll);
+static struct lock_class_key udp_callback_key;
+
struct proto udp_prot = {
.name = "UDP",
.owner = THIS_MODULE,
@@ -1899,6 +1901,7 @@ struct proto udp_prot = {
.compat_setsockopt = compat_udp_setsockopt,
.compat_getsockopt = compat_udp_getsockopt,
#endif
+ .callback_key = &udp_callback_key,
};
EXPORT_SYMBOL(udp_prot);
@@ -32,6 +32,8 @@ static const struct net_protocol udplite_protocol = {
.netns_ok = 1,
};
+static struct lock_class_key udplite_callback_key;
+
struct proto udplite_prot = {
.name = "UDP-Lite",
.owner = THIS_MODULE,
@@ -57,6 +59,7 @@ struct proto udplite_prot = {
.compat_setsockopt = compat_udp_setsockopt,
.compat_getsockopt = compat_udp_getsockopt,
#endif
+ .callback_key = &udplite_callback_key,
};
EXPORT_SYMBOL(udplite_prot);
@@ -1441,6 +1441,8 @@ void udp6_proc_exit(struct net *net) {
/* ------------------------------------------------------------------------ */
+static struct lock_class_key udp6_callback_key;
+
struct proto udpv6_prot = {
.name = "UDPv6",
.owner = THIS_MODULE,
@@ -1469,6 +1471,7 @@ struct proto udpv6_prot = {
.compat_setsockopt = compat_udpv6_setsockopt,
.compat_getsockopt = compat_udpv6_getsockopt,
#endif
+ .callback_key = &udp6_callback_key,
};
static struct inet_protosw udpv6_protosw = {
@@ -31,6 +31,8 @@ static const struct inet6_protocol udplitev6_protocol = {
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
};
+static struct lock_class_key udp6lite_callback_key;
+
struct proto udplitev6_prot = {
.name = "UDPLITEv6",
.owner = THIS_MODULE,
@@ -55,6 +57,7 @@ struct proto udplitev6_prot = {
.compat_setsockopt = compat_udpv6_setsockopt,
.compat_getsockopt = compat_udpv6_getsockopt,
#endif
+ .callback_key = &udp6lite_callback_key,
};
static struct inet_protosw udplite6_protosw = {