diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-22 22:48:48 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-22 22:48:48 -0500 |
commit | c86373faa01918197f4996eb155e188a0ab5b58b (patch) | |
tree | 72e6fd110b864612e647cc9f05ae22035de650c4 | |
parent | 4df1a32675f62275ae04f03225c897340d0cca23 (diff) |
net: convert to lock_cmp_fn
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | net/core/sock.c | 1 | ||||
-rw-r--r-- | net/unix/af_unix.c | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index fef349dd72fa..05dd6ddddae6 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3470,6 +3470,7 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid) sk->sk_peer_pid = NULL; sk->sk_peer_cred = NULL; spin_lock_init(&sk->sk_peer_lock); + lock_set_cmp_fn_ptr_order(&sk->sk_peer_lock); sk->sk_write_pending = 0; sk->sk_rcvlowat = 1; diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index ac1f2bc18fc9..1587cfe0f881 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -170,7 +170,7 @@ static void unix_table_double_lock(struct net *net, swap(hash1, hash2); spin_lock(&net->unx.table.locks[hash1]); - spin_lock_nested(&net->unx.table.locks[hash2], SINGLE_DEPTH_NESTING); + spin_lock(&net->unx.table.locks[hash2]); } static void unix_table_double_unlock(struct net *net, @@ -706,10 +706,10 @@ static void copy_peercred(struct sock *sk, struct sock *peersk) if (sk < peersk) { spin_lock(&sk->sk_peer_lock); - spin_lock_nested(&peersk->sk_peer_lock, SINGLE_DEPTH_NESTING); + spin_lock(&peersk->sk_peer_lock); } else { spin_lock(&peersk->sk_peer_lock); - spin_lock_nested(&sk->sk_peer_lock, SINGLE_DEPTH_NESTING); + spin_lock(&sk->sk_peer_lock); } old_pid = sk->sk_peer_pid; old_cred = sk->sk_peer_cred; @@ -3575,6 +3575,7 @@ static int __net_init unix_net_init(struct net *net) for (i = 0; i < UNIX_HASH_SIZE; i++) { spin_lock_init(&net->unx.table.locks[i]); + lock_set_cmp_fn_ptr_order(&net->unx.table.locks[i]); INIT_HLIST_HEAD(&net->unx.table.buckets[i]); } |