[PATCH 07/13] sys: use cred_ids_allow_sched() for setpriority()
Josef Bacik
josef at toxicpanda.com
Sun Oct 18 17:31:49 UTC 2026
set_one_prio_perm() makes the two comparisons of check_same_owner(),
written the other way around. Use the library.
No functional change.
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef at toxicpanda.com>
---
kernel/sys.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index 35b538ba843c..efef06240a8f 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -220,8 +220,7 @@ static bool set_one_prio_perm(struct task_struct *p)
{
const struct cred *cred = current_cred(), *pcred = __task_cred(p);
- if (uid_eq(pcred->uid, cred->euid) ||
- uid_eq(pcred->euid, cred->euid))
+ if (cred_ids_allow_sched(cred, pcred))
return true;
if (ns_capable(pcred->user_ns, CAP_SYS_NICE))
return true;
--
2.55.0
More information about the Linux-security-module-archive
mailing list