diff --git a/patches.suse/bcache-Revert-bcache-use-bvec_virt-2878.patch b/patches.suse/bcache-Revert-bcache-use-bvec_virt-2878.patch new file mode 100644 index 0000000..6de5379 --- /dev/null +++ b/patches.suse/bcache-Revert-bcache-use-bvec_virt-2878.patch @@ -0,0 +1,47 @@ +From 2878feaed543c35f9dbbe6d8ce36fb67ac803eef Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Wed, 3 Nov 2021 23:10:41 +0800 +Subject: [PATCH] bcache: Revert "bcache: use bvec_virt" +Git-commit: 2878feaed543c35f9dbbe6d8ce36fb67ac803eef +Patch-mainline: v5.16-rc1 +References: git-fixes, bsc#1205493 + +This reverts commit 2fd3e5efe791946be0957c8e1eed9560b541fe46. + +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: 2fd3e5efe791 ("bcache: use bvec_virt") +Signed-off-by: Coly Li +Cc: Christoph Hellwig +Cc: stable@vger.kernel.org # 5.15 +Signed-off-by: Christoph Hellwig +Link: https://lore.kernel.org/r/20211103151041.70516-1-colyli@suse.de +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/btree.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index 93b67b8d31c3..88c573eeb598 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -378,7 +378,7 @@ static void do_btree_node_write(struct btree *b) + struct bvec_iter_all iter_all; + + bio_for_each_segment_all(bv, b->bio, iter_all) { +- memcpy(bvec_virt(bv), addr, PAGE_SIZE); ++ memcpy(page_address(bv->bv_page), addr, PAGE_SIZE); + addr += PAGE_SIZE; + } + +-- +2.39.2 + diff --git a/series.conf b/series.conf index 12d40d7..12f2704 100644 --- a/series.conf +++ b/series.conf @@ -11295,6 +11295,7 @@ patches.suse/ataflop-address-add_disk-error-handling-on-probe.patch patches.suse/floppy-address-add_disk-error-handling-on-probe.patch patches.suse/ataflop-Add-missing-semicolon-to-return-statement.patch + patches.suse/bcache-Revert-bcache-use-bvec_virt-2878.patch patches.suse/rpmsg-Fix-rpmsg_create_ept-return-when-RPMSG-config-.patch patches.suse/remoteproc-elf_loader-Fix-loading-segment-when-is_io.patch patches.suse/remoteproc-Fix-the-wrong-default-value-of-is_iomem.patch