]> git.baikalelectronics.ru Git - kernel.git/commit
bfq: Make sure bfqg for which we are queueing requests is online
authorJan Kara <jack@suse.cz>
Fri, 1 Apr 2022 10:27:50 +0000 (12:27 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Apr 2022 01:34:32 +0000 (19:34 -0600)
commit4c94a2597cf6e0958a875f9d7f74b6fb08862a16
tree1ee475cc8a7b1e20af6a23ff799f5a174cc96324
parenta650ebd53aca84d664381d5d4b99daf75572d0e1
bfq: Make sure bfqg for which we are queueing requests is online

Bios queued into BFQ IO scheduler can be associated with a cgroup that
was already offlined. This may then cause insertion of this bfq_group
into a service tree. But this bfq_group will get freed as soon as last
bio associated with it is completed leading to use after free issues for
service tree users. Fix the problem by making sure we always operate on
online bfq_group. If the bfq_group associated with the bio is not
online, we pick the first online parent.

CC: stable@vger.kernel.org
Fixes: e6c0e1d5b810 ("block, bfq: add full hierarchical scheduling and cgroups support")
Tested-by: "yukuai (C)" <yukuai3@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220401102752.8599-9-jack@suse.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-cgroup.c