There is no need to check if this process has the right to modify the specified process when they are same. Signed-off-by: Hongxiang Lou <louhongxiang@xxxxxxxxxx> Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> --- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index 34a842a8eb6a..342c1ce0b433 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1903,7 +1903,7 @@ static int kernel_move_pages(pid_t pid, unsigned long nr_pages, * Check if this process has the right to modify the specified * process. Use the regular "ptrace_may_access()" checks. */ - if (!ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS)) { + if (pid && !ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS)) { rcu_read_unlock(); err = -EPERM; goto out; -- 2.19.1