mmc: core: Prevent bus reference leak in mmc_blk_init()
authorAlexander Kappner <agk@godking.net>
Wed, 28 Mar 2018 22:18:31 +0000 (15:18 -0700)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 4 Apr 2018 07:56:23 +0000 (09:56 +0200)
commitd0a0852b9f81cf5f793bf2eae7336ed40a1a1815
treea41bd7a09cf53cdca99dd2cc835befc0599b79b6
parenta04f0017c22453613d5f423326b190c61e3b4f98
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>
drivers/mmc/core/block.c