[RHEL7,COMMIT] mm/memcontrol.c: lost css_put in memcg_expand_shrinker_maps()

Submitted by Konstantin Khorenko on Feb. 26, 2020, 2:49 p.m.


Message ID 202002261449.01QEnNJF021525@finist-ce7.sw.ru
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko Feb. 26, 2020, 2:49 p.m.
The commit is pushed to "branch-rh7-3.10.0-1062.12.1.vz7.131.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.12.1.vz7.131.4
commit 7be4534c26627167c9812e23bd6235ae9ad3963c
Author: Vasily Averin <vvs@virtuozzo.com>
Date:   Wed Feb 26 17:49:22 2020 +0300

    mm/memcontrol.c: lost css_put in memcg_expand_shrinker_maps()
    for_each_mem_cgroup() increases css reference counter for memory cgroup
    and requires to use mem_cgroup_iter_break() if the walk is cancelled.
    Link: http://lkml.kernel.org/r/c98414fb-7e1f-da0f-867a-9340ec4bd30b@virtuozzo.com
    Fixes: 0a4465d34028 ("mm, memcg: assign memcg-aware shrinkers bitmap to memcg")
    Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
    Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Reviewed-by: Roman Gushchin <guro@fb.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
 mm/memcontrol.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 163370e375630..b0727105f5369 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -825,8 +825,10 @@  int memcg_expand_shrinker_maps(int new_id)
 		if (mem_cgroup_is_root(memcg))
 		ret = memcg_expand_one_shrinker_map(memcg, size, old_size);
-		if (ret)
+		if (ret) {
+			mem_cgroup_iter_break(NULL, memcg);
 			goto unlock;
+		}
 	if (!ret)