[BUGFIX][PATCH] memcg: use rcu_dereference to access mm->owner

From: KAMEZAWA Hiroyuki
Date: Mon Apr 13 2009 - 02:45:45 EST


the patch itself is against mmotm-Apr11.
Maybe it's better to apply 2.6.30-rc series.
==
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>

mm->owner should be accessed with rcu_dereference().

Reported-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
---
include/linux/memcontrol.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: mmotm-2.6.30-Apr11/include/linux/memcontrol.h
===================================================================
--- mmotm-2.6.30-Apr11.orig/include/linux/memcontrol.h
+++ mmotm-2.6.30-Apr11/include/linux/memcontrol.h
@@ -75,7 +75,7 @@ int mm_match_cgroup(const struct mm_stru
{
struct mem_cgroup *mem;
rcu_read_lock();
- mem = mem_cgroup_from_task((mm)->owner);
+ mem = mem_cgroup_from_task(rcu_dereference((mm)->owner));
rcu_read_unlock();
return cgroup == mem;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/