aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kappner <agk@godking.net>2018-03-28 18:18:31 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2018-04-04 03:56:23 -0400
commitd0a0852b9f81cf5f793bf2eae7336ed40a1a1815 (patch)
treea41bd7a09cf53cdca99dd2cc835befc0599b79b6
parenta04f0017c22453613d5f423326b190c61e3b4f98 (diff)
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 <agk@godking.net> Fixes: 97548575bef3 ("mmc: block: Convert RPMB to a character device") Cc: <stable@vger.kernel.org> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/core/block.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index a2b9c2500c4c..758657e4a85e 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -3080,6 +3080,7 @@ static void __exit mmc_blk_exit(void)
3080 mmc_unregister_driver(&mmc_driver); 3080 mmc_unregister_driver(&mmc_driver);
3081 unregister_blkdev(MMC_BLOCK_MAJOR, "mmc"); 3081 unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");
3082 unregister_chrdev_region(mmc_rpmb_devt, MAX_DEVICES); 3082 unregister_chrdev_region(mmc_rpmb_devt, MAX_DEVICES);
3083 bus_unregister(&mmc_rpmb_bus_type);
3083} 3084}
3084 3085
3085module_init(mmc_blk_init); 3086module_init(mmc_blk_init);