From: Liu, Changcheng Date: Sat, 16 Dec 2017 15:15:45 +0000 (+0800) Subject: mmc: block: fix logical error to avoid memory leak X-Git-Tag: v4.15.13~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=176fb28073c945c56c4db0dfacc3d7a5d9bf4bcf;p=thirdparty%2Fkernel%2Fstable.git mmc: block: fix logical error to avoid memory leak [ 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 --- diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index ccfa98af1dd3f..b737a95403311 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2623,6 +2623,7 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp) if (n != EXT_CSD_STR_LEN) { err = -EINVAL; + kfree(ext_csd); goto out_free; }