Commit 14a590c3f987977d7b09ec926481ee0238c08eee
1 parent
8751e03958
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
userns: Convert cgroup permission checks to use uid_eq
Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Showing 2 changed files with 3 additions and 4 deletions Side-by-side Diff
init/Kconfig
kernel/cgroup.c
... | ... | @@ -2160,9 +2160,9 @@ |
2160 | 2160 | * only need to check permissions on one of them. |
2161 | 2161 | */ |
2162 | 2162 | tcred = __task_cred(tsk); |
2163 | - if (cred->euid && | |
2164 | - cred->euid != tcred->uid && | |
2165 | - cred->euid != tcred->suid) { | |
2163 | + if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) && | |
2164 | + !uid_eq(cred->euid, tcred->uid) && | |
2165 | + !uid_eq(cred->euid, tcred->suid)) { | |
2166 | 2166 | rcu_read_unlock(); |
2167 | 2167 | ret = -EACCES; |
2168 | 2168 | goto out_unlock_cgroup; |