diff options
author | James Morris <jmorris@namei.org> | 2008-12-25 01:40:09 +0100 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-12-25 01:40:09 +0100 |
commit | cbacc2c7f066a1e01b33b0e27ae5efbf534bc2db (patch) | |
tree | 90d1093131d2a3543a8b3b1f3364e7c6f4081a93 /mm/migrate.c | |
parent | Linux 2.6.28 (diff) | |
parent | SELinux: don't check permissions for kernel mounts (diff) | |
download | linux-cbacc2c7f066a1e01b33b0e27ae5efbf534bc2db.tar.xz linux-cbacc2c7f066a1e01b33b0e27ae5efbf534bc2db.zip |
Merge branch 'next' into for-linus
Diffstat (limited to 'mm/migrate.c')
-rw-r--r-- | mm/migrate.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mm/migrate.c b/mm/migrate.c index 037b0967c1e3..21631ab8c08b 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1075,6 +1075,7 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages, const int __user *nodes, int __user *status, int flags) { + const struct cred *cred = current_cred(), *tcred; struct task_struct *task; struct mm_struct *mm; int err; @@ -1105,12 +1106,16 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages, * capabilities, superuser privileges or the same * userid as the target process. */ - if ((current->euid != task->suid) && (current->euid != task->uid) && - (current->uid != task->suid) && (current->uid != task->uid) && + rcu_read_lock(); + tcred = __task_cred(task); + if (cred->euid != tcred->suid && cred->euid != tcred->uid && + cred->uid != tcred->suid && cred->uid != tcred->uid && !capable(CAP_SYS_NICE)) { + rcu_read_unlock(); err = -EPERM; goto out; } + rcu_read_unlock(); err = security_task_movememory(task); if (err) |