Re: [PATCH] block, bfq: fix null pointer dereference in bfq_bio_bfqg()

From: Yu Kuai
Date: Tue Nov 08 2022 - 08:15:17 EST


Hi!

在 2022/11/08 20:48, Jan Kara 写道:

Hum, that is indeed contrieved ;). Your fixup makes sense so feel free to
add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

Thanks for the review, our test do many unusual operations together...

Thanks,
Kuai

Honza


diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 144bca006463..7d624a3a3f0f 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -610,6 +610,10 @@ struct bfq_group *bfq_bio_bfqg(struct bfq_data *bfqd, struct bio *bio)
struct bfq_group *bfqg;
while (blkg) {
+ if (!blkg->online) {
+ blkg = blkg->parent;
+ continue;
+ }
bfqg = blkg_to_bfqg(blkg);
if (bfqg->online) {
bio_associate_blkg_from_css(bio, &blkg->blkcg->css);
--
2.31.1