summaryrefslogtreecommitdiff
path: root/security/selinux/ss/services.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-07-10 17:05:15 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-07-10 17:05:15 +0300
commit8a9117cc8847db9471a0d6becab86b91b9eb8c33 (patch)
tree14520613174a9d26b2f18925cfb9cedae63be165 /security/selinux/ss/services.c
parent90c8478b2b9942883ad3051374975156ebd07067 (diff)
parentfbad404f04d758c52bae79ca20d0e7fe5fef91d3 (diff)
downloadlinux-rolling-lts.tar.xz
Merge v6.12.37linux-rolling-lts
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r--security/selinux/ss/services.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 88850405ded9..f36332e64c4d 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -1884,11 +1884,17 @@ retry:
goto out_unlock;
}
/* Obtain the sid for the context. */
- rc = sidtab_context_to_sid(sidtab, &newcontext, out_sid);
- if (rc == -ESTALE) {
- rcu_read_unlock();
- context_destroy(&newcontext);
- goto retry;
+ if (context_cmp(scontext, &newcontext))
+ *out_sid = ssid;
+ else if (context_cmp(tcontext, &newcontext))
+ *out_sid = tsid;
+ else {
+ rc = sidtab_context_to_sid(sidtab, &newcontext, out_sid);
+ if (rc == -ESTALE) {
+ rcu_read_unlock();
+ context_destroy(&newcontext);
+ goto retry;
+ }
}
out_unlock:
rcu_read_unlock();