提交 92c3d8b6 编写于 作者: M Muchun Song 提交者: Yang Yingliang

mm/memcontrol.c: add missed css_put()

mainline inclusion
from mainline-v5.8-rc3
commit 3a98990a
category: bugfix
bugzilla: 34611
CVE: NA

-------------------------------------------------

We should put the css reference when memory allocation failed.

Link: http://lkml.kernel.org/r/20200614122653.98829-1-songmuchun@bytedance.com
Fixes: f0a3a24b ("mm: memcg/slab: rework non-root kmem_cache lifecycle management")
Signed-off-by: NMuchun Song <songmuchun@bytedance.com>
Acked-by: NRoman Gushchin <guro@fb.com>
Acked-by: NMichal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Qian Cai <cai@lca.pw>
Cc: <stable@vger.kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 8bd1f1bc
...@@ -2654,8 +2654,10 @@ static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, ...@@ -2654,8 +2654,10 @@ static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
return; return;
cw = kmalloc(sizeof(*cw), GFP_NOWAIT | __GFP_NOWARN); cw = kmalloc(sizeof(*cw), GFP_NOWAIT | __GFP_NOWARN);
if (!cw) if (!cw) {
css_put(&memcg->css);
return; return;
}
cw->memcg = memcg; cw->memcg = memcg;
cw->cachep = cachep; cw->cachep = cachep;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册