linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/2] mm: memcg: use proper memcg in limit bypass
@ 2013-10-24  9:58 Johannes Weiner
  2013-10-24  9:58 ` [patch 2/2] mm: memcg: fix test for child groups Johannes Weiner
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Weiner @ 2013-10-24  9:58 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Michal Hocko, linux-mm, linux-kernel

84235de ("fs: buffer: move allocation failure loop into the
allocator") allowed __GFP_NOFAIL allocations to bypass the limit if
they fail to reclaim enough memory for the charge.  Because the main
test case was on a 3.2-based system, this patch missed the fact that
on newer kernels the charge function needs to return root_mem_cgroup
when bypassing the limit, and not NULL.  This will corrupt whatever
memory is at NULL + percpu pointer offset.  Fix this quickly before
problems are reported.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/memcontrol.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 34d3ca9..13a9c80 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2765,10 +2765,10 @@ done:
 	*ptr = memcg;
 	return 0;
 nomem:
-	*ptr = NULL;
-	if (gfp_mask & __GFP_NOFAIL)
-		return 0;
-	return -ENOMEM;
+	if (!(gfp_mask & __GFP_NOFAIL)) {
+		*ptr = NULL;
+		return -ENOMEM;
+	}
 bypass:
 	*ptr = root_mem_cgroup;
 	return -EINTR;
-- 
1.8.4.1

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

end of thread, other threads:[~2013-10-24  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-24  9:58 [patch 1/2] mm: memcg: use proper memcg in limit bypass Johannes Weiner
2013-10-24  9:58 ` [patch 2/2] mm: memcg: fix test for child groups Johannes Weiner

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