forked from luck/tmp_suning_uos_patched
mm/mempolicy.c: add rcu read lock to protect pid structure
find_task_by_vpid() should be protected by rcu_read_lock(), to prevent free_pid() reclaiming pid. Signed-off-by: Zeng Zhaoming <zengzm.kernel@gmail.com> Cc: "Paul E. McKenney" <paulmck@us.ibm.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Christoph Lameter <cl@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
1f64d69c7a
commit
55cfaa3cbd
|
@ -1307,15 +1307,18 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
|
|||
goto out;
|
||||
|
||||
/* Find the mm_struct */
|
||||
rcu_read_lock();
|
||||
read_lock(&tasklist_lock);
|
||||
task = pid ? find_task_by_vpid(pid) : current;
|
||||
if (!task) {
|
||||
read_unlock(&tasklist_lock);
|
||||
rcu_read_unlock();
|
||||
err = -ESRCH;
|
||||
goto out;
|
||||
}
|
||||
mm = get_task_mm(task);
|
||||
read_unlock(&tasklist_lock);
|
||||
rcu_read_unlock();
|
||||
|
||||
err = -EINVAL;
|
||||
if (!mm)
|
||||
|
|
Loading…
Reference in New Issue
Block a user