Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1405485

[PATCH] mm: memcontrol: fix possible css ref leak on oom

From Vladimir Davydov <vdavydov@virtuozzo.com>
Newsgroups linux.kernel
Subject [PATCH] mm: memcontrol: fix possible css ref leak on oom
Date 2016-05-23 18:10 +0200
Message-ID <rC0Ax-861-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mm: memcontrol: fix possible css ref leak on oom Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-23 18:10 +0200
  Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom Michal Hocko <mhocko@kernel.org> - 2016-05-23 19:50 +0200
    Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom Michal Hocko <mhocko@kernel.org> - 2016-05-24 10:50 +0200
      Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-24 11:20 +0200
        Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom Michal Hocko <mhocko@kernel.org> - 2016-05-24 11:30 +0200
          Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-24 12:10 +0200
            Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom Michal Hocko <mhocko@kernel.org> - 2016-05-24 13:40 +0200
    Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-24 11:20 +0200
  Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom Johannes Weiner <hannes@cmpxchg.org> - 2016-05-27 19:40 +0200
    Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-29 11:20 +0200
    Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom Michal Hocko <mhocko@kernel.org> - 2016-05-30 09:30 +0200

csiph-web