]> git.baikalelectronics.ru Git - kernel.git/commit
bcache: Revert "bcache: use bvec_virt"
authorColy Li <colyli@suse.de>
Wed, 3 Nov 2021 15:10:41 +0000 (23:10 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 8 Nov 2021 13:23:17 +0000 (06:23 -0700)
commitb7d59d6fc866df9d83c3f78e6a977c7b8a5e37cd
tree18fb4a6a9867c61126be18ff6cc44358de82f06b
parente2aeeabef1ce90a8e9850d2a0e5e20d8a5f8fa95
bcache: Revert "bcache: use bvec_virt"

This reverts commit 6a7236a5c786dbecb470b215118c4ae8ca2e8428.

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: 6a7236a5c786 ("bcache: use bvec_virt")
Signed-off-by: Coly Li <colyli@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org # 5.15
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211103151041.70516-1-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/btree.c