From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754309AbdEQJWh (ORCPT ); Wed, 17 May 2017 05:22:37 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:54149 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753408AbdEQJWd (ORCPT ); Wed, 17 May 2017 05:22:33 -0400 Date: Wed, 17 May 2017 17:17:26 +0800 From: Jisheng Zhang To: Andrew Lunn CC: , , , , , Subject: Re: [PATCH] mmc: sdhci-xenon: kill xenon_clean_phy() Message-ID: <20170517171726.2ede556d@xhacker> In-Reply-To: <20170516122211.GA27959@lunn.ch> References: <20170516061720.1755-1-jszhang@marvell.com> <20170516122211.GA27959@lunn.ch> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-17_07:,, signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705170071 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 16 May 2017 14:22:11 +0200 Andrew Lunn wrote: > 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 > > --- > > 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 Hi Andrew, > > If the memory has been allocated using the devm_ API, calling kfree > here is wrong, and can lead to a double free. Yes. In fact, I found this issue by unbinding then binding the xenon host. > > So this patch should probably have a fixes: tag. Should it also goto > stable? As pointed out by RMK, the sdhci-xenon driver is merged in current 4.12-rc1, so we just need to apply this fix in later rcN. Thanks, Jisheng