]> www.infradead.org Git - users/hch/block.git/commitdiff
block: call bio_associate_blkg from bio_reset bio-reset-fix
authorChristoph Hellwig <hch@lst.de>
Fri, 4 Feb 2022 06:57:54 +0000 (07:57 +0100)
committerChristoph Hellwig <hch@lst.de>
Fri, 4 Feb 2022 07:07:11 +0000 (08:07 +0100)
Call bio_associate_blkg just like bio_set_dev did in the callers before
the conversion to set the block device in bio_reset.

Fixes: a7c50c940477 ("block: pass a block_device and opf to bio_reset")
Reported-by: syzbot+2b3f18414c37b42dcc94@syzkaller.appspotmail.com
Signed-off-by: Christoph Hellwig <hch@lst.de>
block/bio.c

index 2e19ca600fcdbc5cf1b3c9046254ba773d68704a..d2f3c103503641867a0c70cbb3e8d46524a2e62a 100644 (file)
@@ -310,6 +310,8 @@ void bio_reset(struct bio *bio, struct block_device *bdev, unsigned int opf)
        memset(bio, 0, BIO_RESET_BYTES);
        atomic_set(&bio->__bi_remaining, 1);
        bio->bi_bdev = bdev;
+       if (bio->bi_bdev)
+               bio_associate_blkg(bio);
        bio->bi_opf = opf;
 }
 EXPORT_SYMBOL(bio_reset);