All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Jisheng Zhang <jszhang@marvell.com>
Cc: adrian.hunter@intel.com, huziji@marvell.com,
	ulf.hansson@linaro.org, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] mmc: sdhci-xenon: kill xenon_clean_phy()
Date: Tue, 16 May 2017 14:22:11 +0200	[thread overview]
Message-ID: <20170516122211.GA27959@lunn.ch> (raw)
In-Reply-To: <20170516061720.1755-1-jszhang@marvell.com>

On Tue, May 16, 2017 at 02:17:20PM +0800, Jisheng Zhang wrote:
> Currently, the xenon_clean_phy() is only used for freeing phy_params.
> The phy_params is allocated by devm_kzalloc(), there's no need to free
> is explicitly.
> 
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> ---
>  drivers/mmc/host/sdhci-xenon-phy.c | 14 +-------------
>  drivers/mmc/host/sdhci-xenon.c     |  6 +-----
>  drivers/mmc/host/sdhci-xenon.h     |  1 -
>  3 files changed, 2 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-xenon-phy.c b/drivers/mmc/host/sdhci-xenon-phy.c
> index 6356781f1cca..f7e26b031e76 100644
> --- a/drivers/mmc/host/sdhci-xenon-phy.c
> +++ b/drivers/mmc/host/sdhci-xenon-phy.c
> @@ -787,14 +787,6 @@ int xenon_phy_adj(struct sdhci_host *host, struct mmc_ios *ios)
>  	return ret;
>  }
>  
> -void xenon_clean_phy(struct sdhci_host *host)
> -{
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
> -
> -	kfree(priv->phy_params);

Hi Jisheng

If the memory has been allocated using the devm_ API, calling kfree
here is wrong, and can lead to a double free.

So this patch should probably have a fixes: tag. Should it also goto
stable?

	Andrew

WARNING: multiple messages have this Message-ID (diff)
From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmc: sdhci-xenon: kill xenon_clean_phy()
Date: Tue, 16 May 2017 14:22:11 +0200	[thread overview]
Message-ID: <20170516122211.GA27959@lunn.ch> (raw)
In-Reply-To: <20170516061720.1755-1-jszhang@marvell.com>

On Tue, May 16, 2017 at 02:17:20PM +0800, Jisheng Zhang wrote:
> Currently, the xenon_clean_phy() is only used for freeing phy_params.
> The phy_params is allocated by devm_kzalloc(), there's no need to free
> is explicitly.
> 
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> ---
>  drivers/mmc/host/sdhci-xenon-phy.c | 14 +-------------
>  drivers/mmc/host/sdhci-xenon.c     |  6 +-----
>  drivers/mmc/host/sdhci-xenon.h     |  1 -
>  3 files changed, 2 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-xenon-phy.c b/drivers/mmc/host/sdhci-xenon-phy.c
> index 6356781f1cca..f7e26b031e76 100644
> --- a/drivers/mmc/host/sdhci-xenon-phy.c
> +++ b/drivers/mmc/host/sdhci-xenon-phy.c
> @@ -787,14 +787,6 @@ int xenon_phy_adj(struct sdhci_host *host, struct mmc_ios *ios)
>  	return ret;
>  }
>  
> -void xenon_clean_phy(struct sdhci_host *host)
> -{
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
> -
> -	kfree(priv->phy_params);

Hi Jisheng

If the memory has been allocated using the devm_ API, calling kfree
here is wrong, and can lead to a double free.

So this patch should probably have a fixes: tag. Should it also goto
stable?

	Andrew

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

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16  6:17 [PATCH] mmc: sdhci-xenon: kill xenon_clean_phy() Jisheng Zhang
2017-05-16  6:17 ` Jisheng Zhang
2017-05-16  6:17 ` Jisheng Zhang
2017-05-16 12:22 ` Andrew Lunn [this message]
2017-05-16 12:22   ` Andrew Lunn
2017-05-16 12:48   ` Russell King - ARM Linux
2017-05-16 12:48     ` Russell King - ARM Linux
2017-05-17  9:17   ` Jisheng Zhang
2017-05-17  9:17     ` Jisheng Zhang
2017-05-17  9:17     ` Jisheng Zhang
2017-05-17 11:56     ` Andrew Lunn
2017-05-17 11:56       ` Andrew Lunn
2017-05-17  6:50 ` Hu Ziji
2017-05-17  6:50   ` Hu Ziji
2017-05-17  6:50   ` Hu Ziji
2017-05-17 10:19 ` Adrian Hunter
2017-05-17 10:19   ` Adrian Hunter
2017-05-19  8:30 ` Ulf Hansson
2017-05-19  8:30   ` Ulf Hansson

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=20170516122211.GA27959@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=adrian.hunter@intel.com \
    --cc=huziji@marvell.com \
    --cc=jszhang@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.