Received: by 10.192.165.148 with SMTP id m20csp2527490imm; Sun, 22 Apr 2018 08:54:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx48QariNkZn95zIkZElY6kswUYXslbVdJXfR0lBNVgwoMlgpjhDLKygjcCxcZii0RcEEIqZJ X-Received: by 10.99.189.26 with SMTP id a26mr14677399pgf.157.1524412486053; Sun, 22 Apr 2018 08:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524412486; cv=none; d=google.com; s=arc-20160816; b=SHN7dz5oOOGktmyz6qbPXL9FH81W4SVBZhXU/3g1vBtCjTCAgTJX7W30UZUUwdnHQJ 6KangriXgFxpebdtlHssZaak4Sqau6W2RaCvwDmJ2t0W8xlaRUHGFWs4kogFO3pLRFaP BGXnVdj8nikW4WBoyRPrEU0ohQUaylOPct+Omi3z7PbyE18msNrktIDlg9D3Nnd3To6i p1BjkoipqrlUkMpJhVq7+cDr0f6/+xCIrsKqSrCm8OGGS1GAIoVMqY7Iymfo/pjg54Em wb96xe0l5I5GEwRV1oO2oNFHltfaXxp61PKTatzQMHG0K26vFj8gmg77E6BMedrTSNHn PexA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=RaQvu7DFlGkCtD1HrItopWGMlzCTXz+o+2eYw3vvYQ0=; b=pMHOpHeDz9yCBy9nwDr2YNRLpvDa9arke1eUFtteaKnI+GN59Eil8WxoffBtm807Io Odrco6pOpH/s41PhrYmZI7D7OziRCAV1ytY4+w8nZTHoDVxm0VPtJHYFb7dJ+lNj+KqV ckR0btMV0Y/1DtiF8bsXO/Gg2CCRIAlSzs+rsoyh4WJTgB6b4jMbj8nzIWu/ADKSMATz zjl0+/5vFBffJKaxuiw7gVscmw4xsAc1ciA/G7ZavXiNXMf0ZYBvyCoiveckQu1LgNvI ocqKa6DJsz3b7xMV7EJEhPYfY5qh4y9c/xBKiVsD/ZrM8/1Ai5LVS1lZNYcUGbcM9MMm 0YDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi12-v6si9635106plb.333.2018.04.22.08.54.31; Sun, 22 Apr 2018 08:54:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754757AbeDVPwz (ORCPT + 99 others); Sun, 22 Apr 2018 11:52:55 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47274 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754502AbeDVOAN (ORCPT ); Sun, 22 Apr 2018 10:00:13 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CD5F992F; Sun, 22 Apr 2018 14:00:12 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Kappner , Shawn Lin , Ulf Hansson Subject: [PATCH 4.16 131/196] mmc: core: Prevent bus reference leak in mmc_blk_init() Date: Sun, 22 Apr 2018 15:52:31 +0200 Message-Id: <20180422135111.021365153@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 triggered. 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) mmc_unregister_driver(&mmc_driver); unregister_blkdev(MMC_BLOCK_MAJOR, "mmc"); unregister_chrdev_region(mmc_rpmb_devt, MAX_DEVICES); + bus_unregister(&mmc_rpmb_bus_type); } module_init(mmc_blk_init);