diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2025-06-25 03:20:43 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2025-06-25 03:20:43 +0300 |
commit | 7595b66ae9de667bf35a8c99e8f1bfc4792e207e (patch) | |
tree | a63790151e1d7e63ca534ceeba85637d6f68d604 | |
parent | 78f4e737a53e1163ded2687a922fce138aee73f5 (diff) | |
parent | fde46f60f6c5138ee422087addbc5bf5b4968bf1 (diff) | |
download | linux-7595b66ae9de667bf35a8c99e8f1bfc4792e207e.tar.xz |
Merge tag 'selinux-pr-20250624' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux fix from Paul Moore:
"Another small SELinux patch to fix a problem seen by the dracut-ng
folks during early boot when SELinux is enabled, but the policy has
yet to be loaded"
* tag 'selinux-pr-20250624' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
selinux: change security_compute_sid to return the ssid or tsid on match
-rw-r--r-- | security/selinux/ss/services.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 7becf3808818..d185754c2786 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -1909,11 +1909,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_equal(scontext, &newcontext)) + *out_sid = ssid; + else if (context_equal(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(); |