mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
block: fix "check bi_size overflow before merge"
commit cc90bc68422318eb8e75b15cd74bc8d538a7df29 upstream. This partially reverts commite3a5d8e386. Commite3a5d8e386("check bi_size overflow before merge") adds a bio_full check to __bio_try_merge_page. This will cause __bio_try_merge_page to fail when the last bi_io_vec has been reached. Instead, what we want here is only the bi_size overflow check. Fixes:e3a5d8e386("block: check bi_size overflow before merge") Cc: [email protected] # v5.4+ Reviewed-by: Ming Lei <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]> Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
f092fa8da2
commit
06ad673b6c
1 changed files with 3 additions and 1 deletions
|
|
@ -751,10 +751,12 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page,
|
|||
if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)))
|
||||
return false;
|
||||
|
||||
if (bio->bi_vcnt > 0 && !bio_full(bio, len)) {
|
||||
if (bio->bi_vcnt > 0) {
|
||||
struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1];
|
||||
|
||||
if (page_is_mergeable(bv, page, len, off, same_page)) {
|
||||
if (bio->bi_iter.bi_size > UINT_MAX - len)
|
||||
return false;
|
||||
bv->bv_len += len;
|
||||
bio->bi_iter.bi_size += len;
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue