Skip to content

Commit

Permalink
direct-io: be sure to assign dio->bio_bdev for both paths
Browse files Browse the repository at this point in the history
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: kernel test robot <ying.huang@linux.intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Jens Axboe committed Nov 10, 2015
1 parent 15c4f63 commit c1c5346
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/direct-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
bio_set_pages_dirty(bio);

dio->bio_bdev = bio->bi_bdev;

if (sdio->submit_io) {
sdio->submit_io(dio->rw, bio, dio->inode,
sdio->logical_offset_in_bio);
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;
Expand Down

0 comments on commit c1c5346

Please sign in to comment.