diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2019-12-09 20:11:14 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-17 20:08:40 +0100 |
commit | 9d2710fe8bf0b62996f4c8e0edd0ade0d3a34127 (patch) | |
tree | 95efb418c77e612fbb4c3a9b9bbce92196bbf052 | |
parent | d0400f5906e95d743d2e5dc84d5876e833fde856 (diff) | |
download | linux-stable-9d2710fe8bf0b62996f4c8e0edd0ade0d3a34127.tar.gz linux-stable-9d2710fe8bf0b62996f4c8e0edd0ade0d3a34127.tar.bz2 linux-stable-9d2710fe8bf0b62996f4c8e0edd0ade0d3a34127.zip |
block: fix "check bi_size overflow before merge"
[ Upstream commit cc90bc68422318eb8e75b15cd74bc8d538a7df29 ]
This partially reverts commit e3a5d8e386c3fb973fa75f2403622a8f3640ec06.
Commit e3a5d8e386c3 ("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: e3a5d8e386c3 ("block: check bi_size overflow before merge")
Cc: stable@vger.kernel.org # v5.4+
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | block/bio.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/bio.c b/block/bio.c index 31d56e7e2ce0..853e2a2ec4d9 100644 --- a/block/bio.c +++ b/block/bio.c @@ -769,10 +769,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; |