mirror of https://github.com/torvalds/linux.git
block: fix merging data-less bios
The data segment gaps the block layer tracks doesn't apply to bio's that
don't have data. Skip calculating this to fix a NULL pointer access.
Fixes: 2f6b2565d4 ("block: accumulate memory segment gaps per bio")
Reported-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Yu Kuai <yukuai@fnnas.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
727a440278
commit
fd9ecd0052
|
|
@ -737,6 +737,9 @@ u8 bio_seg_gap(struct request_queue *q, struct bio *prev, struct bio *next,
|
||||||
{
|
{
|
||||||
struct bio_vec pb, nb;
|
struct bio_vec pb, nb;
|
||||||
|
|
||||||
|
if (!bio_has_data(prev))
|
||||||
|
return 0;
|
||||||
|
|
||||||
gaps_bit = min_not_zero(gaps_bit, prev->bi_bvec_gap_bit);
|
gaps_bit = min_not_zero(gaps_bit, prev->bi_bvec_gap_bit);
|
||||||
gaps_bit = min_not_zero(gaps_bit, next->bi_bvec_gap_bit);
|
gaps_bit = min_not_zero(gaps_bit, next->bi_bvec_gap_bit);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue