浏览代码

mm: memcontrol: fix possible css ref leak on oom

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.

Link: http://lkml.kernel.org/r/1464019330-7579-1-git-send-email-vdavydov@virtuozzo.com
Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Vladimir Davydov 9 年之前
父节点
当前提交
1383399d7b
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      mm/memcontrol.c

+ 1 - 1
mm/memcontrol.c

@@ -1604,7 +1604,7 @@ static void memcg_oom_recover(struct mem_cgroup *memcg)
 
 
 static void mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order)
 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;
 		return;
 	/*
 	/*
 	 * We are in the middle of the charge context here, so we
 	 * We are in the middle of the charge context here, so we