linux/drivers/md/bcache
Mingzhe Zou e9941e7963 bcache: fix uninitialized closure object
commit 20a8e451ec upstream.

In the previous patch ("bcache: fix cached_dev.sb_bio use-after-free and
crash"), we adopted a simple modification suggestion from AI to fix the
use-after-free.

But in actual testing, we found an extreme case where the device is
stopped before calling bch_write_bdev_super().

At this point, struct closure sb_write has not been initialized yet.
For this patch, we ensure that sb_bio has been completed via
sb_write_mutex.

Signed-off-by: Mingzhe Zou <mingzhe.zou@easystack.cn>
Signed-off-by: Coly Li <colyli@fnnas.com>
Link: https://patch.msgid.link/20260403042135.2221247-1-colyli@fnnas.com
Fixes: fec114a98b ("bcache: fix cached_dev.sb_bio use-after-free and crash")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-06-01 17:35:26 +02:00
..
alloc.c bcache: remove PTR_CACHE 2021-04-11 08:37:55 -06:00
bcache.h bcache: avoid oversize memory allocation by small stripe_size 2023-12-20 15:17:39 +01:00
bset.c bcache: fix variable length array abuse in btree_iter 2024-07-05 09:14:36 +02:00
bset.h bcache: fix variable length array abuse in btree_iter 2024-07-05 09:14:36 +02:00
btree.c bcache: fix variable length array abuse in btree_iter 2024-07-05 09:14:36 +02:00
btree.h bcache: fixup btree_cache_wait list damage 2023-07-23 13:47:32 +02:00
closure.c bcache: Convert to DEFINE_SHOW_ATTRIBUTE 2020-10-02 14:25:29 -06:00
closure.h bcache: fix typo in code comments of closure_return_with_destructor() 2018-10-08 08:19:43 -06:00
debug.c bcache: fix a regression of code compiling failure in debug.c 2021-04-11 08:37:56 -06:00
debug.h bcache: add identifier names to arguments of function definitions 2018-08-11 15:46:41 -06:00
extents.c bcache: remove PTR_CACHE 2021-04-11 08:37:55 -06:00
extents.h bcache: add identifier names to arguments of function definitions 2018-08-11 15:46:41 -06:00
features.c bcache: use NULL instead of using plain integer as pointer 2021-04-11 08:37:56 -06:00
features.h bcache: only check feature sets when sb->version >= BCACHE_SB_VERSION_CDEV_WITH_FEATURES 2021-01-28 07:35:07 -07:00
io.c bcache: remove PTR_CACHE 2021-04-11 08:37:55 -06:00
journal.c bcache: avoid journal no-space deadlock by reserving 1 journal bucket 2022-06-09 10:23:29 +02:00
journal.h bcache: avoid journal no-space deadlock by reserving 1 journal bucket 2022-06-09 10:23:29 +02:00
Kconfig block: make the block holder code optional 2021-08-09 11:50:42 -06:00
Makefile bcache: add sysfs file to display feature sets information of cache set 2020-07-25 07:38:21 -06:00
movinggc.c bcache: remove for_each_cache() 2020-10-02 14:25:29 -06:00
request.c md: bcache: check the return value of kzalloc() in detached_dev_do_request() 2022-06-09 10:23:32 +02:00
request.h block: move ->make_request_fn to struct block_device_operations 2020-07-01 07:27:24 -06:00
stats.c bcache: remove bcache device self-defined readahead 2021-06-08 15:06:03 -06:00
stats.h bcache: remove bcache device self-defined readahead 2021-06-08 15:06:03 -06:00
super.c bcache: fix uninitialized closure object 2026-06-01 17:35:26 +02:00
sysfs.c bcache: fix variable length array abuse in btree_iter 2024-07-05 09:14:36 +02:00
sysfs.h bcache: add sysfs_strtoul_bool() for setting bit-field variables 2019-02-09 07:18:32 -07:00
trace.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
util.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
util.h block: move some macros to blkdev.h 2021-08-11 19:40:28 -06:00
writeback.c bcache: fix variable length array abuse in btree_iter 2024-07-05 09:14:36 +02:00
writeback.h bcache: improve multithreaded bch_sectors_dirty_init() 2022-06-09 10:23:28 +02:00