linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: memcontrol: fix possible css ref leak on oom
@ 2016-05-23 16:02 Vladimir Davydov
  2016-05-23 17:44 ` Michal Hocko
  2016-05-27 17:36 ` Johannes Weiner
  0 siblings, 2 replies; 11+ messages in thread
From: Vladimir Davydov @ 2016-05-23 16:02 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Johannes Weiner, Michal Hocko, linux-mm, linux-kernel

mem_cgroup_oom may be invoked multiple times while a process is handling
a page fault, in which case current->memcg_in_oom will be overwritten
leaking the previously taken css reference.

Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
---
 mm/memcontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 5b48cd25951b..ef8797d34039 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1608,7 +1608,7 @@ static void memcg_oom_recover(struct mem_cgroup *memcg)
 
 static void mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order)
 {
-	if (!current->memcg_may_oom)
+	if (!current->memcg_may_oom || current->memcg_in_oom)
 		return;
 	/*
 	 * We are in the middle of the charge context here, so we
-- 
2.1.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	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-05-30  7:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-23 16:02 [PATCH] mm: memcontrol: fix possible css ref leak on oom Vladimir Davydov
2016-05-23 17:44 ` Michal Hocko
2016-05-24  8:43   ` Vladimir Davydov
2016-05-24  8:47     ` Michal Hocko
2016-05-24  9:01       ` Vladimir Davydov
2016-05-24  9:22         ` Michal Hocko
2016-05-24 10:05           ` Vladimir Davydov
2016-05-24 11:31             ` Michal Hocko
2016-05-27 17:36 ` Johannes Weiner
2016-05-29  9:11   ` Vladimir Davydov
2016-05-30  7:26   ` Michal Hocko

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