Return-Path: From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Changcheng , Adrian Hunter , Linus Walleij , Ulf Hansson , Sasha Levin Subject: [PATCH 4.15 32/84] mmc: block: fix logical error to avoid memory leak Date: Fri, 23 Mar 2018 10:53:46 +0100 Message-Id: <20180323095416.741312213@linuxfoundation.org> In-Reply-To: <20180323095411.913234798@linuxfoundation.org> References: <20180323095411.913234798@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Liu, Changcheng" [ Upstream commit 0be55579a127916ebe39db2a74d906a2dfceed42 ] If the MMC_DRV_OP_GET_EXT_CSD request completes successfully, then ext_csd must be freed, but in one case it was not. Fix that. Signed-off-by: Liu Changcheng Acked-by: Adrian Hunter Acked-by: Linus Walleij Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin 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 @@ -2623,6 +2623,7 @@ static int mmc_ext_csd_open(struct inode if (n != EXT_CSD_STR_LEN) { err = -EINVAL; + kfree(ext_csd); goto out_free; }