
From: Tejun Heo <tj@kernel.org> mainline inclusion from mainline-5.3-rc1 commit 71c814077de60b2e7415dac6f5c4e98f59d521fd category: feature bugzilla: 38688 CVE: NA --------------------------- When blkcg_activate_policy() is creating blkg_policy_data for existing blkgs, it did in the wrong order - descendants first. Fix it. None of the existing controllers seem affected by this. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk> Conflict: block/blk-cgroup.c Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- block/blk-cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 8038c2b83f853..4a8151ecd8a66 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1445,7 +1445,8 @@ int blkcg_activate_policy(struct request_queue *q, spin_lock_irq(q->queue_lock); - list_for_each_entry(blkg, &q->blkg_list, q_node) { + /* blkg_list is pushed at the head, reverse walk to init parents first */ + list_for_each_entry_reverse(blkg, &q->blkg_list, q_node) { struct blkg_policy_data *pd; if (blkg->pd[pol->plid]) -- 2.25.1