Commit e87f89e9 authored by GONG, Ruiqi's avatar GONG, Ruiqi
Browse files

Revert "memcg: fix a UAF problem in drain_all_stock()"

hulk inclusion
category: bugfix
bugzilla: 189183, https://gitee.com/openeuler/kernel/issues/I7Z1ZU


CVE: NA

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

This reverts commit 616e7082 ("memcg: fix a UAF problem in
drain_all_stock()"), which was produced based on in-house 3.10 and later
was found to be not suitable for in-house 4.18/4.19, as both of them use
async version of drain_all_stock() whose actual draining could be
delayed, and some of them even removed drain_all_stock() from memcg's
offline process. In these cases the commit doesn't fix the original
problem.

Fixes: 616e7082 ("memcg: fix a UAF problem in drain_all_stock()")
Signed-off-by: default avatarGONG, Ruiqi <gongruiqi1@huawei.com>
parent f4144fbf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2232,7 +2232,8 @@ static void drain_all_stock(struct mem_cgroup *root_memcg)

		rcu_read_lock();
		memcg = stock->cached;
		if (memcg && mem_cgroup_is_descendant(memcg, root_memcg))
		if (memcg && stock->nr_pages &&
		    mem_cgroup_is_descendant(memcg, root_memcg))
			flush = true;
		rcu_read_unlock();