[lkml]   [2018]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 4.16 131/196] mmc: core: Prevent bus reference leak in mmc_blk_init()
4.16-stable review patch.  If anyone has any objections, please let me know.


From: Alexander Kappner <>

commit d0a0852b9f81cf5f793bf2eae7336ed40a1a1815 upstream.

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

Fix the bug by dropping the reference for the bus in mmc_blk_exit().

Signed-off-by: Alexander Kappner <>
Fixes: 97548575bef3 ("mmc: block: Convert RPMB to a character device")
Cc: <>
Reviewed-by: Shawn Lin <>
Signed-off-by: Ulf Hansson <>
Signed-off-by: Greg Kroah-Hartman <>

drivers/mmc/core/block.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -3087,6 +3087,7 @@ static void __exit mmc_blk_exit(void)
unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");
unregister_chrdev_region(mmc_rpmb_devt, MAX_DEVICES);
+ bus_unregister(&mmc_rpmb_bus_type);


 \ /
  Last update: 2018-04-22 17:53    [W:0.608 / U:0.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site