* [PATCH] mm: add rcu read lock to protect pid structure
@ 2010-10-27 22:33 zeng.zhaoming
0 siblings, 0 replies; 2+ messages in thread
From: zeng.zhaoming @ 2010-10-27 22:33 UTC (permalink / raw)
To: linux-mm; +Cc: Zeng Zhaoming
From: Zeng Zhaoming <zengzm.kernel@gmail.com>
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>
---
mm/mempolicy.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 81a1276..ceaf0d8 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -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)
--
1.7.0.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] mm: add rcu read lock to protect pid structure
@ 2010-10-28 5:52 Zeng Zhaoming
0 siblings, 0 replies; 2+ messages in thread
From: Zeng Zhaoming @ 2010-10-28 5:52 UTC (permalink / raw)
To: linux-mm
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>
---
mm/mempolicy.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 81a1276..ceaf0d8 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -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)
--
1.7.0.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-28 6:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-27 22:33 [PATCH] mm: add rcu read lock to protect pid structure zeng.zhaoming
-- strict thread matches above, loose matches on Subject: below --
2010-10-28 5:52 Zeng Zhaoming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).