From 7971642235ab4808631a09f0b1b9e3042eb9349e Mon Sep 17 00:00:00 2001 From: Coly Li Date: Apr 04 2023 11:46:37 +0000 Subject: bcache: fix wrong bdev parameter when calling bio_alloc_clone() in do_bio_hook() (git-fixes, bsc#1205493). --- diff --git a/patches.suse/bcache-fix-wrong-bdev-parameter-when-calling-bio_alloc_clone-in-do_bio_hook-9dca.patch b/patches.suse/bcache-fix-wrong-bdev-parameter-when-calling-bio_alloc_clone-in-do_bio_hook-9dca.patch new file mode 100644 index 0000000..b52449d --- /dev/null +++ b/patches.suse/bcache-fix-wrong-bdev-parameter-when-calling-bio_alloc_clone-in-do_bio_hook-9dca.patch @@ -0,0 +1,46 @@ +From 9dca4168a37c9cfe182f077f0d2289292e9e3656 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Wed, 20 Apr 2022 00:04:25 +0800 +Subject: [PATCH] bcache: fix wrong bdev parameter when calling + bio_alloc_clone() in do_bio_hook() +Git-commit: 9dca4168a37c9cfe182f077f0d2289292e9e3656 +Patch-mainline: v5.18-rc4 +References: git-fixes, bsc#1205493 + +Commit abfc426d1b2f ("block: pass a block_device to bio_clone_fast") +calls the modified bio_alloc_clone() in bcache code as: + bio_init_clone(bio->bi_bdev, bio, orig_bio, GFP_NOIO); + +But the first parameter is wrong, where bio->bi_bdev should be +orig_bio->bi_bdev. The wrong bi_bdev panics the kernel when submitting +cache bio. + +This patch fixes the wrong bdev parameter usage and avoid the panic. + +Fixes: abfc426d1b2f ("block: pass a block_device to bio_clone_fast") +Signed-off-by: Coly Li +Cc: Christoph Hellwig +Cc: Mike Snitzer +Link: https://lore.kernel.org/r/20220419160425.4148-3-colyli@suse.de +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/request.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c +index fdd0194f84dd..320fcdfef48e 100644 +--- a/drivers/md/bcache/request.c ++++ b/drivers/md/bcache/request.c +@@ -685,7 +685,7 @@ static void do_bio_hook(struct search *s, + { + struct bio *bio = &s->bio.bio; + +- bio_init_clone(bio->bi_bdev, bio, orig_bio, GFP_NOIO); ++ bio_init_clone(orig_bio->bi_bdev, bio, orig_bio, GFP_NOIO); + /* + * bi_end_io can be set separately somewhere else, e.g. the + * variants in, +-- +2.39.2 + diff --git a/series.conf b/series.conf index 86ef6d7..0f3f072 100644 --- a/series.conf +++ b/series.conf @@ -23398,6 +23398,7 @@ patches.suse/io_uring-free-iovec-if-file-assignment-fails.patch patches.suse/io_uring-fix-leaks-on-IOPOLL-and-CQE_SKIP.patch patches.suse/bcache-put-bch_bio_map-back-to-correct-location-in-journal_write_unlocked-ff26.patch + patches.suse/bcache-fix-wrong-bdev-parameter-when-calling-bio_alloc_clone-in-do_bio_hook-9dca.patch patches.suse/Input-omap4-keypad-fix-pm_runtime_get_sync-error-che.patch patches.suse/1576-drm-radeon-fix-logic-inversion-in-radeon_sync_resv.patch patches.suse/drm-panel-raspberrypi-touchscreen-Avoid-NULL-deref-i.patch