aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Davydov <[email protected]>2016-05-23 16:22:29 -0700
committerLinus Torvalds <[email protected]>2016-05-23 17:04:14 -0700
commit1383399d7be029281997889df23150fa6c16be6e (patch)
tree9cdc21abe7297912673a4d540b50d45c932603f6
parentf43edca7ed08fc02279f2a62015da5cb6aa0ad61 (diff)
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/[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]>
-rw-r--r--mm/memcontrol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b3f16ab4b431..cf428d7b9a03 100644
--- a/mm/memcontrol.c
+++ b/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)
{
- 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