Commit c1c53460 authored by Jens Axboe's avatar Jens Axboe

direct-io: be sure to assign dio->bio_bdev for both paths

btrfs sets ->submit_io(), and we failed to set the block dev for
that path. That resulted in a potential NULL dereference when
we later wait for IO in dio_await_one().
Reported-by: default avatarkernel test robot <>
Signed-off-by: default avatarJens Axboe <>
parent 15c4f638
......@@ -399,14 +399,14 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio)
if (dio->is_async && dio->rw == READ && dio->should_dirty)
dio->bio_bdev = bio->bi_bdev;
if (sdio->submit_io) {
sdio->submit_io(dio->rw, bio, dio->inode,
dio->bio_cookie = BLK_QC_T_NONE;
} else {
} else
dio->bio_cookie = submit_bio(dio->rw, bio);
dio->bio_bdev = bio->bi_bdev;
sdio->bio = NULL;
sdio->boundary = 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment