]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
apparmor: fix shadowing of plabel that prevents cache from being updated
authorJohn Johansen <john.johansen@canonical.com>
Thu, 23 Oct 2025 06:46:19 +0000 (23:46 -0700)
committerJohn Johansen <john.johansen@canonical.com>
Sun, 14 Jun 2026 03:14:06 +0000 (20:14 -0700)
Unfortunately the plabel was being shadowed by an unused local var.
This didn't affect the mediation check but did cauase the cache to
not correctly be updated resulting in extra mediation checks.

Fixes: 88fec3526e841 ("apparmor: make sure unix socket labeling is correctly updated.")
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/af_unix.c

index fdb4a9f212c3bf856e645ec6a80aa4847f1dd7b2..09ce3f6da20ce75187013b268c00bee78ca76fde 100644 (file)
@@ -758,11 +758,10 @@ int aa_unix_file_perm(const struct cred *subj_cred, struct aa_label *label,
                           unix_fs_perm(op, request, subj_cred, label,
                                        is_unix_fs(peer_sk) ? &peer_path : NULL));
        } else if (!is_sk_fs) {
-               struct aa_label *plabel;
                struct aa_sk_ctx *pctx = aa_sock(peer_sk);
 
                rcu_read_lock();
-               plabel = aa_get_label_rcu(&pctx->label);
+               plabel = aa_get_newest_label(pctx->label);
                rcu_read_unlock();
                /* no fs check of aa_unix_peer_perm because conditions above
                 * ensure they will never be done