]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 10 Aug 2022 07:25:08 +0000 (09:25 +0200)
commit5ffd37e60b9127690d9549ba408b2088d16600a1
treecdce55181b269b0c26911e6f923ce163cfa3cded
parentc433a00e682d27eec8a532e6b7e7d704b19f9a5f
bfq: Make sure bfqg for which we are queueing requests is online

BugLink: https://bugs.launchpad.net/bugs/1981864
commit 075a53b78b815301f8d3dd1ee2cd99554e34f0dd upstream.

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: e21b7a0b9887 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
block/bfq-cgroup.c