Skip to content

Commit d0a0852

Browse files
Alexander Kappnerstorulf
authored andcommitted
mmc: core: Prevent bus reference leak in mmc_blk_init()
Upon module load, mmc_block allocates a bus with bus_registeri() in mmc_blk_init(). This reference never gets freed during module unload, which leads to subsequent re-insertions of the module fails and a WARN() splat is triggered. Fix the bug by dropping the reference for the bus in mmc_blk_exit(). Signed-off-by: Alexander Kappner <[email protected]> Fixes: 9754857 ("mmc: block: Convert RPMB to a character device") Cc: <[email protected]> Reviewed-by: Shawn Lin <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent a04f001 commit d0a0852

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/mmc/core/block.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3080,6 +3080,7 @@ static void __exit mmc_blk_exit(void)
30803080
mmc_unregister_driver(&mmc_driver);
30813081
unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");
30823082
unregister_chrdev_region(mmc_rpmb_devt, MAX_DEVICES);
3083+
bus_unregister(&mmc_rpmb_bus_type);
30833084
}
30843085

30853086
module_init(mmc_blk_init);

0 commit comments

Comments
 (0)