diff options
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 1e0d6b237f44..0461fc6c961c 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -1042,6 +1042,7 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages, | |||
1042 | const int __user *nodes, | 1042 | const int __user *nodes, |
1043 | int __user *status, int flags) | 1043 | int __user *status, int flags) |
1044 | { | 1044 | { |
1045 | const struct cred *cred = current_cred(), *tcred; | ||
1045 | struct task_struct *task; | 1046 | struct task_struct *task; |
1046 | struct mm_struct *mm; | 1047 | struct mm_struct *mm; |
1047 | int err; | 1048 | int err; |
@@ -1072,12 +1073,16 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages, | |||
1072 | * capabilities, superuser privileges or the same | 1073 | * capabilities, superuser privileges or the same |
1073 | * userid as the target process. | 1074 | * userid as the target process. |
1074 | */ | 1075 | */ |
1075 | if ((current->euid != task->suid) && (current->euid != task->uid) && | 1076 | rcu_read_lock(); |
1076 | (current->uid != task->suid) && (current->uid != task->uid) && | 1077 | tcred = __task_cred(task); |
1078 | if (cred->euid != tcred->suid && cred->euid != tcred->uid && | ||
1079 | cred->uid != tcred->suid && cred->uid != tcred->uid && | ||
1077 | !capable(CAP_SYS_NICE)) { | 1080 | !capable(CAP_SYS_NICE)) { |
1081 | rcu_read_unlock(); | ||
1078 | err = -EPERM; | 1082 | err = -EPERM; |
1079 | goto out; | 1083 | goto out; |
1080 | } | 1084 | } |
1085 | rcu_read_unlock(); | ||
1081 | 1086 | ||
1082 | err = security_task_movememory(task); | 1087 | err = security_task_movememory(task); |
1083 | if (err) | 1088 | if (err) |