summaryrefslogtreecommitdiffstats
path: root/net/unix
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-02-01 23:33:26 +0100
committerJakub Kicinski <kuba@kernel.org>2024-02-02 00:12:37 +0100
commitcf244463a286ea57ea7e63c33614d302f776e62e (patch)
treecaa068596cbfea621376822e30ab545c6516b2c7 /net/unix
parentMerge branch 'dpll-expose-lock-status-error-value-to-user' (diff)
parentMerge tag 'net-6.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netd... (diff)
downloadlinux-cf244463a286ea57ea7e63c33614d302f776e62e.tar.xz
linux-cf244463a286ea57ea7e63c33614d302f776e62e.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR. No conflicts or adjacent changes. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/unix')
-rw-r--r--net/unix/af_unix.c14
-rw-r--r--net/unix/diag.c2
2 files changed, 7 insertions, 9 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 1cfbc586adb4..4892e9428c9f 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1342,13 +1342,11 @@ static void unix_state_double_lock(struct sock *sk1, struct sock *sk2)
unix_state_lock(sk1);
return;
}
- if (sk1 < sk2) {
- unix_state_lock(sk1);
- unix_state_lock_nested(sk2);
- } else {
- unix_state_lock(sk2);
- unix_state_lock_nested(sk1);
- }
+ if (sk1 > sk2)
+ swap(sk1, sk2);
+
+ unix_state_lock(sk1);
+ unix_state_lock_nested(sk2, U_LOCK_SECOND);
}
static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)
@@ -1589,7 +1587,7 @@ restart:
goto out_unlock;
}
- unix_state_lock_nested(sk);
+ unix_state_lock_nested(sk, U_LOCK_SECOND);
if (sk->sk_state != st) {
unix_state_unlock(sk);
diff --git a/net/unix/diag.c b/net/unix/diag.c
index c3648b706509..ae39538c5042 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -84,7 +84,7 @@ static int sk_diag_dump_icons(struct sock *sk, struct sk_buff *nlskb)
* queue lock. With the other's queue locked it's
* OK to lock the state.
*/
- unix_state_lock_nested(req);
+ unix_state_lock_nested(req, U_LOCK_DIAG);
peer = unix_sk(req)->peer;
buf[i++] = (peer ? sock_i_ino(peer) : 0);
unix_state_unlock(req);