Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp668043ybg; Mon, 1 Jun 2020 11:12:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVWkqRiMeb19zWC53pYw3XQYToQ7t3dQ1Y8YImLo6t6w0s9TNMiMz72vX3fvW0oMaek4DR X-Received: by 2002:a17:907:1005:: with SMTP id ox5mr19725061ejb.480.1591035147004; Mon, 01 Jun 2020 11:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591035146; cv=none; d=google.com; s=arc-20160816; b=oL2hLnSsjnroMWcSFDdCcGHWetJbIVzDW7vu1ecsORMCrwPAeg+QfqFRxe+TdtlA0M 6nJKX1uW/irQYGSGfwfOxgrLJvc1Utgmy+gLTagcZpgZwVmqcaos2G5bTJWcHVk8G34u s+omncyWH3wodV0lItgs0Aw2gszOUBCkrC/CVEKTkfCOK0acjVVBIQZqG+MSJ43lZ5FI q5fNlfSLs/u5hgoJ5fUs31ehA8VqEtHb+We5pke/eKIM52kG/lmjqv1CNbDaVBi0BYbM i9IlCDo2MZmeAuz+ZLUDwdWQLdDyPoZsesyqGecJXkGn6BJDN6S50F0KKymUsYACl4hk 3TXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QRrZtzt072y19E+pe35X4XWHqGWS/oSUrwZRyWDb8GQ=; b=UiZiv1iXTjleRjVaz1N1RbOpcRAmTlbRGK8BYtpypvIGL1TffJVbZuEi8cOqQN6KdE G/aU8aC4+h10minR6UFj4OTiFBaHjfWzkILeVou4/sWmd1mrQy/k5IpCxiAjkq4rXVa1 CZ0P9z1VD2WXOanDL+j1mtFcKmzBXF3wLEExKuuYWrbveLmJide6yHVminsG5Sh/l18S E5mNWPf6cYDh83yzUZW5tHcvhAfgLhVKXrzT0iOOeXm+PNMr3CyTt0c/CpPyF0BArrpc 7tKVZS5bzLxt7ACb0dDHASAjUaeI0Ret5xbz9xjVU+qO9SoezvtCA9dcHNvQAmOMHORF V2KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=icz1PvW0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i9si62630edf.484.2020.06.01.11.12.03; Mon, 01 Jun 2020 11:12:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=icz1PvW0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729816AbgFASJH (ORCPT + 99 others); Mon, 1 Jun 2020 14:09:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:55448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728839AbgFASJG (ORCPT ); Mon, 1 Jun 2020 14:09:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EF61A2068D; Mon, 1 Jun 2020 18:09:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591034946; bh=HVW0Oq4vPyzNpfObjgAt+27ZFCmKdfiWbHLdxnQVxtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icz1PvW08JTvR+S7Q7IXRNXG6tZhgAMqxzj6FrZ3isAvQZoEi4QLvHtF/OLBAqu22 xjDLy72gmeA1gcdlSDtJHIxr/6qQo8etKekq8LiJrwdmLb6vq1bXXMfRmUBePNXPxs iGfjVuw/kHnaAc/Ly4v96+H1SX6s+pgcCDqhfDM0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Hao , Ulf Hansson , Sasha Levin Subject: [PATCH 5.4 083/142] mmc: block: Fix use-after-free issue for rpmb Date: Mon, 1 Jun 2020 19:54:01 +0200 Message-Id: <20200601174046.549387147@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Hao [ Upstream commit 202500d21654874aa03243e91f96de153ec61860 ] The data structure member “rpmb->md” was passed to a call of the function “mmc_blk_put” after a call of the function “put_device”. Reorder these function calls to keep the data accesses consistent. Fixes: 1c87f7357849 ("mmc: block: Fix bug when removing RPMB chardev ") Signed-off-by: Peng Hao Cc: stable@vger.kernel.org [Uffe: Fixed up mangled patch and updated commit message] Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/core/block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 9d01b5dca519..7f480c6b1981 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2475,8 +2475,8 @@ static int mmc_rpmb_chrdev_release(struct inode *inode, struct file *filp) struct mmc_rpmb_data *rpmb = container_of(inode->i_cdev, struct mmc_rpmb_data, chrdev); - put_device(&rpmb->dev); mmc_blk_put(rpmb->md); + put_device(&rpmb->dev); return 0; } -- 2.25.1