[SRU][F/J/M][PATCH 2/2] UBUNTU: SAUCE: af_unix: fix lockdep positive in sk_diag_dump_icons()
Yuxuan Luo
yuxuan.luo at canonical.com
Wed Mar 27 00:18:35 UTC 2024
[ upstream commit 4d322dce82a1d44f8c83f0f54f95dd1b8dcf46c9 ]
The 4d322dce82a1 ("af_unix: fix lockdep positive in
sk_diag_dump_icons()") commit modifies unix_state_lock_nested() which is
copied to security/apparmor/af_unix.c. This commit synchronizes this
change.
CVE-2024-26624
Signed-off-by: Yuxuan Luo <yuxuan.luo at canonical.com>
---
security/apparmor/af_unix.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/security/apparmor/af_unix.c b/security/apparmor/af_unix.c
index 06d6946990b91..d9344ee66af9d 100644
--- a/security/apparmor/af_unix.c
+++ b/security/apparmor/af_unix.c
@@ -578,13 +578,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)
--
2.34.1
More information about the kernel-team
mailing list