From: Kent Overstreet <kent.overstreet@xxxxxxxxx> Date: Fri, 26 Jan 2024 21:08:30 -0500 > Cc: netdev@xxxxxxxxxxxxxxx > Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx> > --- > net/core/sock.c | 1 + > net/unix/af_unix.c | 4 ++-- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/net/core/sock.c b/net/core/sock.c > index 158dbdebce6a..da7360c0f454 100644 > --- a/net/core/sock.c > +++ b/net/core/sock.c > @@ -3474,6 +3474,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..d013de3c5490 100644 > --- a/net/unix/af_unix.c > +++ b/net/unix/af_unix.c > @@ -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); > } hmm.. I think we need not hold two locks here in the first place. Let me post patches. Thanks! > old_pid = sk->sk_peer_pid; > old_cred = sk->sk_peer_cred; > -- > 2.43.0