]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mmc: block: fix logical error to avoid memory leak
authorLiu, Changcheng <changcheng.liu@intel.com>
Sat, 16 Dec 2017 15:15:45 +0000 (23:15 +0800)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Mon, 26 Mar 2018 12:16:24 +0000 (09:16 -0300)
BugLink: http://bugs.launchpad.net/bugs/1758886
[ 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 <changcheng.liu@intel.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/mmc/core/block.c

index ccfa98af1dd3fc93fdaa52b6ced6db3dc0f9db79..b737a9540331101e620bf2b191f96713c3706c9b 100644 (file)
@@ -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;
        }