Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4e97f5d authored by Gao Xiang's avatar Gao Xiang Committed by Greg Kroah-Hartman
Browse files

staging: erofs: fix unexpected out-of-bound data access

Unexpected out-of-bound data will be read in erofs_read_raw_page
after commit 07173c3e ("block: enable multipage bvecs") since
one iovec could have multiple pages.

Let's fix as what Ming's pointed out in the previous email [1].

[1] https://lore.kernel.org/lkml/20190411080953.GE421@ming.t460p/



Suggested-by: default avatarMing Lei <ming.lei@redhat.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarGao Xiang <gaoxiang25@huawei.com>
Fixes: 07173c3e ("block: enable multipage bvecs")
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 663d294b
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -298,7 +298,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
	*last_block = current_block;
	*last_block = current_block;


	/* shift in advance in case of it followed by too many gaps */
	/* shift in advance in case of it followed by too many gaps */
	if (unlikely(bio->bi_vcnt >= bio->bi_max_vecs)) {
	if (bio->bi_iter.bi_size >= bio->bi_max_vecs * PAGE_SIZE) {
		/* err should reassign to 0 after submitting */
		/* err should reassign to 0 after submitting */
		err = 0;
		err = 0;
		goto submit_bio_out;
		goto submit_bio_out;