Skip to content

Commit 2878fea

Browse files
Coly Liaxboe
authored andcommitted
bcache: Revert "bcache: use bvec_virt"
This reverts commit 2fd3e5e. The above commit replaces page_address(bv->bv_page) by bvec_virt(bv) to avoid directly access to bv->bv_page, but in situation bv->bv_offset is not zero and page_address(bv->bv_page) is not equal to bvec_virt(bv). In such case a memory corruption may happen because memory in next page is tainted by following line in do_btree_node_write(), memcpy(bvec_virt(bv), addr, PAGE_SIZE); This patch reverts the mentioned commit to avoid the memory corruption. Fixes: 2fd3e5e ("bcache: use bvec_virt") Signed-off-by: Coly Li <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: [email protected] # 5.15 Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 38987a8 commit 2878fea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/md/bcache/btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ static void do_btree_node_write(struct btree *b)
378378
struct bvec_iter_all iter_all;
379379

380380
bio_for_each_segment_all(bv, b->bio, iter_all) {
381-
memcpy(bvec_virt(bv), addr, PAGE_SIZE);
381+
memcpy(page_address(bv->bv_page), addr, PAGE_SIZE);
382382
addr += PAGE_SIZE;
383383
}
384384

0 commit comments

Comments
 (0)