aboutsummaryrefslogtreecommitdiff
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2011-11-02 13:38:21 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-02 16:07:00 -0700
commit0a619e58703b86d53d07e938eade9a91a4a863c6 (patch)
tree0579cebdbdbb90507db04b320acb4191f8a86f2e /mm/memcontrol.c
parent715a5ee82ab3c07430f748630044354132add5ad (diff)
memcg: do not expose uninitialized mem_cgroup_per_node to world
If somebody is touching data too early, it might be easier to diagnose a problem when dereferencing NULL at mem->info.nodeinfo[node] than trying to understand why mem_cgroup_per_zone is [un|partly]initialized. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Michal Hocko <mhocko@suse.cz> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c02d87028b9..f6c4beb4db5 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4742,7 +4742,6 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node)
if (!pn)
return 1;
- memcg->info.nodeinfo[node] = pn;
for (zone = 0; zone < MAX_NR_ZONES; zone++) {
mz = &pn->zoneinfo[zone];
for_each_lru(l)
@@ -4751,6 +4750,7 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node)
mz->on_tree = false;
mz->mem = memcg;
}
+ memcg->info.nodeinfo[node] = pn;
return 0;
}