projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f679142
)
block: prevent an integer overflow in bvec_try_merge_hw_page
author
Christoph Hellwig
<hch@lst.de>
Mon, 4 Dec 2023 17:34:18 +0000
(18:34 +0100)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Mon, 5 Feb 2024 20:14:24 +0000
(20:14 +0000)
[ 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>
block/bio.c
patch
|
blob
|
history
diff --git
a/block/bio.c
b/block/bio.c
index
5eba53c
..
270f6b9
100644
(file)
--- a/
block/bio.c
+++ b/
block/bio.c
@@
-944,7
+944,7
@@
bool bvec_try_merge_hw_page(struct request_queue *q, struct bio_vec *bv,
if ((addr1 | mask) != (addr2 | mask))
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 bvec_try_merge_page(bv, page, len, offset, same_page);
}