From: Michal Hocko <[email protected]>
Subject: Revert "memcg: avoid dangling reference count in creation failure"

This reverts e4715f01be697a.

mem_cgroup_put is hierarchy aware so mem_cgroup_put(memcg) already drops
an additional reference from all parents so the additional
mem_cgrroup_put(parent) potentially causes use-after-free.

Signed-off-by: Michal Hocko <[email protected]>
Signed-off-by: Li Zefan <[email protected]>
Acked-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Glauber Costa <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: <[email protected]>    [3.9+]
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/memcontrol.c |    2 --
 1 file changed, 2 deletions(-)

diff -puN 
mm/memcontrol.c~revert-memcg-avoid-dangling-reference-count-in-creation-failure 
mm/memcontrol.c
--- 
a/mm/memcontrol.c~revert-memcg-avoid-dangling-reference-count-in-creation-failure
+++ a/mm/memcontrol.c
@@ -6352,8 +6352,6 @@ mem_cgroup_css_online(struct cgroup *con
                 * call __mem_cgroup_free, so return directly
                 */
                mem_cgroup_put(memcg);
-               if (parent->use_hierarchy)
-                       mem_cgroup_put(parent);
        }
        return error;
 }
_
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to