[PATCH V2 0/6] null_blk: fix init/exit races, leaks and cleanup
From: Zizhi Wo
Date: Mon Jul 06 2026 - 23:03:35 EST
This series fixes several issues in null_blk around lock initialization,
concurrent configfs access, and module init/exit cleanup.
Patches 1-2 fix the uninitialized mutex. Following Bart's suggestion, the
fix now uses DEFINE_MUTEX() and renames the lock.
Patch 3 fixes configfs registration concurrency.
Patch 4 reorders resource release in null_exit() to match null_init().
Patch 5 fixes a data race where the NULLB_DEVICE_ATTR macro locklessly
overwrote dev state already set under the lock by apply_fn().
Patch 6 fixes a global tag_set leak on the null_init() error path.
See the individual patch descriptions for details.
Changes since v1:
- Added patches 4-6, and modify the lock name in patch 2.
https://lore.kernel.org/all/20260706123507.3809871-1-wozizhi@xxxxxxxxxxxxxxx/
Zizhi Wo (6):
null_blk: use DEFINE_MUTEX for the file-scope mutex
null_blk: give the file-scope mutex a descriptive name
null_blk: register configfs subsystem after creating default devices
null_blk: move unregister_blkdev() after destroying dev in null_exit()
null_blk: don't locklessly overwrite dev state after apply_fn
null_blk: free global tag_set on init error path
drivers/block/null_blk/main.c | 70 +++++++++++++++++------------------
1 file changed, 34 insertions(+), 36 deletions(-)
--
2.52.0