From c93b3b2ec3fe93550657d644102d6839ad722cc0 Mon Sep 17 00:00:00 2001 From: Coly Li Date: Apr 04 2023 11:46:36 +0000 Subject: bcache: put bch_bio_map() back to correct location in journal_write_unlocked() (git-fixes, bsc#1205493). --- diff --git a/patches.suse/bcache-put-bch_bio_map-back-to-correct-location-in-journal_write_unlocked-ff26.patch b/patches.suse/bcache-put-bch_bio_map-back-to-correct-location-in-journal_write_unlocked-ff26.patch new file mode 100644 index 0000000..a682edb --- /dev/null +++ b/patches.suse/bcache-put-bch_bio_map-back-to-correct-location-in-journal_write_unlocked-ff26.patch @@ -0,0 +1,52 @@ +From ff2695e52c9936febf65aa36a1769881da71bec5 Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Wed, 20 Apr 2022 00:04:24 +0800 +Subject: [PATCH] bcache: put bch_bio_map() back to correct location in + journal_write_unlocked() +Git-commit: ff2695e52c9936febf65aa36a1769881da71bec5 +Patch-mainline: v5.18-rc4 +References: git-fixes, bsc#1205493 + +Commit a7c50c940477 ("block: pass a block_device and opf to bio_reset") +moves bch_bio_map() inside journal_write_unlocked() next to the location +where the modified bio_reset() was called. + +This change is wrong because calling bch_bio_map() immediately after +bio_reset(), a BUG_ON(!bio->bi_iter.bi_size) inside bch_bio_map() will +be triggered and panic the kernel. + +This patch puts bch_bio_map() back to its original correct location in +journal_write_unlocked() and avoid the BUG_ON(). + +Fixes: a7c50c940477 ("block: pass a block_device and opf to bio_reset") +Signed-off-by: Coly Li +Cc: Christoph Hellwig +Cc: Chaitanya Kulkarni +Link: https://lore.kernel.org/r/20220419160425.4148-2-colyli@suse.de +Signed-off-by: Jens Axboe + +--- + drivers/md/bcache/journal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c +index 7c2ca52ca3e4..df5347ea450b 100644 +--- a/drivers/md/bcache/journal.c ++++ b/drivers/md/bcache/journal.c +@@ -771,12 +771,12 @@ static void journal_write_unlocked(struct closure *cl) + + bio_reset(bio, ca->bdev, REQ_OP_WRITE | + REQ_SYNC | REQ_META | REQ_PREFLUSH | REQ_FUA); +- bch_bio_map(bio, w->data); + bio->bi_iter.bi_sector = PTR_OFFSET(k, i); + bio->bi_iter.bi_size = sectors << 9; + + bio->bi_end_io = journal_write_endio; + bio->bi_private = w; ++ bch_bio_map(bio, w->data); + + trace_bcache_journal_write(bio, w->data->keys); + bio_list_add(&list, bio); +-- +2.39.2 + diff --git a/series.conf b/series.conf index 12f2704..86ef6d7 100644 --- a/series.conf +++ b/series.conf @@ -23397,6 +23397,7 @@ patches.suse/ext4-force-overhead-calculation-if-the-s_overhead_cl.patch 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/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