diff --git a/patches.suse/bcache-replace-a-mistaken-IS_ERR-by-IS_ERR_OR_NULL-i-f72f.patch b/patches.suse/bcache-replace-a-mistaken-IS_ERR-by-IS_ERR_OR_NULL-i-f72f.patch new file mode 100644 index 0000000..73c2540 --- /dev/null +++ b/patches.suse/bcache-replace-a-mistaken-IS_ERR-by-IS_ERR_OR_NULL-i-f72f.patch @@ -0,0 +1,57 @@ +From f72f4312d4388376fc8a1f6cf37cb21a0d41758b Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Mon, 20 Nov 2023 13:25:01 +0800 +Subject: [PATCH] bcache: replace a mistaken IS_ERR() by IS_ERR_OR_NULL() in + btree_gc_coalesce() +Git-commit: f72f4312d4388376fc8a1f6cf37cb21a0d41758b +Patch-mainline: v6.7-rc3 +References: git-fixes + +Commit 028ddcac477b ("bcache: Remove unnecessary NULL point check in +node allocations") do the following change inside btree_gc_coalesce(), + +31 @@ -1340,7 +1340,7 @@ static int btree_gc_coalesce( +32 memset(new_nodes, 0, sizeof(new_nodes)); +33 closure_init_stack(&cl); +34 +35 - while (nodes < GC_MERGE_NODES && !IS_ERR_OR_NULL(r[nodes].b)) +36 + while (nodes < GC_MERGE_NODES && !IS_ERR(r[nodes].b)) +37 keys += r[nodes++].keys; +38 +39 blocks = btree_default_blocks(b->c) * 2 / 3; + +At line 35 the original r[nodes].b is not always allocatored from +__bch_btree_node_alloc(), and possibly initialized as NULL pointer by +caller of btree_gc_coalesce(). Therefore the change at line 36 is not +correct. + +This patch replaces the mistaken IS_ERR() by IS_ERR_OR_NULL() to avoid +potential issue. + +Fixes: 028ddcac477b ("bcache: Remove unnecessary NULL point check in node allocations") +Cc: # 6.5+ +Cc: Zheng Wang +Signed-off-by: Coly Li +Link: https://lore.kernel.org/r/20231120052503.6122-9-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 de8d552201dc..79f1fa4a0d55 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -1368,7 +1368,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op, + memset(new_nodes, 0, sizeof(new_nodes)); + closure_init_stack(&cl); + +- while (nodes < GC_MERGE_NODES && !IS_ERR(r[nodes].b)) ++ while (nodes < GC_MERGE_NODES && !IS_ERR_OR_NULL(r[nodes].b)) + keys += r[nodes++].keys; + + blocks = btree_default_blocks(b->c) * 2 / 3; +-- +2.35.3 + diff --git a/series.conf b/series.conf index 4bd5fee..dabede2 100644 --- a/series.conf +++ b/series.conf @@ -44849,6 +44849,7 @@ patches.suse/bcache-fixup-init-dirty-data-errors-7cc4.patch patches.suse/bcache-fixup-lock-c-root-error-e348.patch patches.suse/bcache-fixup-multi-threaded-bch_sectors_dirty_init-w-2faa.patch + patches.suse/bcache-replace-a-mistaken-IS_ERR-by-IS_ERR_OR_NULL-i-f72f.patch patches.suse/md-fix-bi_status-reporting-in-md_end_clone_io-45b4.patch patches.suse/s390-dasd-protect-device-queue-against-concurrent-access.patch patches.suse/nvmet-nul-terminate-the-NQNs-passed-in-the-connect-c.patch