public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: "Liu, Changcheng" <changcheng.liu@intel.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	ulf.hansson@linaro.org, linus.walleij@linaro.org
Cc: linux-mmc@vger.kernel.org, akpm@linux-foundation.org,
	changcheng.liu@intel.com
Subject: Re: [PATCH v2] mmc: block: fix logical error to avoid memory leak
Date: Sat, 16 Dec 2017 23:15:45 +0800	[thread overview]
Message-ID: <20171216151545.GA138678@sofia> (raw)
In-Reply-To: <f9294d5a-bd24-8b95-3666-fa75d681bec1@intel.com>

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>

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index ccfa98a..b737a95 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;
 	}
 
-- 
2.7.4

  reply	other threads:[~2017-12-16 15:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14  5:03 [PATCH] mm/block: logical error fix to avoid memory leak Liu, Changcheng
2017-12-15 14:34 ` Adrian Hunter
2017-12-16 15:15   ` Liu, Changcheng [this message]
2017-12-16 19:07     ` [PATCH v2] mmc: block: fix logical error " Linus Walleij
2017-12-18 13:05     ` Ulf Hansson
2017-12-18 13:16       ` Liu, Changcheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171216151545.GA138678@sofia \
    --to=changcheng.liu@intel.com \
    --cc=adrian.hunter@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox