public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memcg: do not expose uninitialized mem_cgroup_per_node to world
@ 2011-06-01 10:44 Igor Mammedov
  2011-06-01 12:39 ` Michal Hocko
  0 siblings, 1 reply; 30+ messages in thread
From: Igor Mammedov @ 2011-06-01 10:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: imammedo, kamezawa.hiroyu, balbir, akpm

Freshly allocated 'mem_cgroup_per_node' list entries must be
initialized before the rest of the kernel can see them. Otherwise
zero initialized list fields can lead to race condition at
mem_cgroup_force_empty_list:
  pc = list_entry(list->prev, struct page_cgroup, lru);
where 'pc' will be something like 0xfffffffc if list->prev is 0
and cause page fault later when 'pc' is dereferenced.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 mm/memcontrol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index bd9052a..ee7cb4c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4707,7 +4707,6 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node)
 	if (!pn)
 		return 1;
 
-	mem->info.nodeinfo[node] = pn;
 	for (zone = 0; zone < MAX_NR_ZONES; zone++) {
 		mz = &pn->zoneinfo[zone];
 		for_each_lru(l)
@@ -4716,6 +4715,7 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node)
 		mz->on_tree = false;
 		mz->mem = mem;
 	}
+	mem->info.nodeinfo[node] = pn;
 	return 0;
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2011-07-27  9:57 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-01 10:44 [PATCH] memcg: do not expose uninitialized mem_cgroup_per_node to world Igor Mammedov
2011-06-01 12:39 ` Michal Hocko
2011-06-01 13:07   ` Igor Mammedov
2011-06-01 13:41     ` Michal Hocko
2011-06-01 14:39       ` Igor Mammedov
2011-06-01 15:20         ` Michal Hocko
2011-06-01 16:42           ` Igor Mammedov
2011-06-01 23:10             ` Hiroyuki Kamezawa
2011-06-03 12:35               ` Igor Mammedov
2011-06-03 13:00                 ` Hiroyuki Kamezawa
2011-06-07 13:25                   ` Igor Mammedov
2011-06-08  3:35                     ` KAMEZAWA Hiroyuki
2011-06-08 21:09                       ` Andrew Morton
2011-06-08 23:44                         ` KAMEZAWA Hiroyuki
2011-06-10 16:57                         ` Igor Mammedov
2011-07-26 21:17                           ` Andrew Morton
2011-07-27  7:58                             ` Michal Hocko
2011-07-27  9:30                               ` Igor Mammedov
2011-07-27  9:57                                 ` Michal Hocko
2011-06-09  8:11                       ` Igor Mammedov
2011-06-09 12:40                         ` Possible shadow bug (was: Re: [PATCH] memcg: do not expose uninitialized mem_cgroup_per_node to world) Stefano Stabellini
2011-06-09 15:01                           ` [Xen-devel] " Tim Deegan
2011-06-09 16:47                             ` [Xen-devel] Possible shadow bug Igor Mammedov
2011-06-10 10:01                               ` Tim Deegan
2011-06-10 10:10                                 ` Tim Deegan
2011-06-10 11:48                                   ` Pasi Kärkkäinen
2011-06-10 12:40                                     ` Tim Deegan
2011-06-10 15:38                                       ` Igor Mammedov
2011-06-10 13:55                                   ` Igor Mammedov
2011-06-01 13:49   ` [PATCH] memcg: do not expose uninitialized mem_cgroup_per_node to world Igor Mammedov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox