]> Git Repo - linux.git/commitdiff
mm: memcontrol: fix possible css ref leak on oom
authorVladimir Davydov <[email protected]>
Mon, 23 May 2016 23:22:29 +0000 (16:22 -0700)
committerLinus Torvalds <[email protected]>
Tue, 24 May 2016 00:04:14 +0000 (17:04 -0700)
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/[email protected]
Signed-off-by: Vladimir Davydov <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Johannes Weiner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/memcontrol.c

index b3f16ab4b4311d00efd34e9e53022a42b0d43d28..cf428d7b9a03a041516e613563d5d051dfc4c610 100644 (file)
@@ -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)
 {
-       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
This page took 0.059587 seconds and 4 git commands to generate.