block: prevent an integer overflow in bvec_try_merge_hw_page
[ Upstream commit 3f034c374ad55773c12dd8f3c1607328e17c0072 ] Reordered a check to avoid a possible overflow when adding len to bv_len. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Link: https://lore.kernel.org/r/20231204173419.782378-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
85f9a7ffdc
commit
59f906cc64
1 changed files with 1 additions and 1 deletions
|
@ -774,7 +774,7 @@ static bool bio_try_merge_hw_seg(struct request_queue *q, struct bio *bio,
|
||||||
|
|
||||||
if ((addr1 | mask) != (addr2 | mask))
|
if ((addr1 | mask) != (addr2 | mask))
|
||||||
return false;
|
return false;
|
||||||
if (bv->bv_len + len > queue_max_segment_size(q))
|
if (len > queue_max_segment_size(q) - bv->bv_len)
|
||||||
return false;
|
return false;
|
||||||
return __bio_try_merge_page(bio, page, len, offset, same_page);
|
return __bio_try_merge_page(bio, page, len, offset, same_page);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue