Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp583547ybc; Fri, 22 Nov 2019 09:45:42 -0800 (PST) X-Google-Smtp-Source: APXvYqylnfaNavj6qePcWwDhEoBHDzEY+vwzjLsXvRJOsANX+Z+JJts2BgDTBhgeANbr9X2aWG6D X-Received: by 2002:a50:ce47:: with SMTP id k7mr2550646edj.150.1574444741989; Fri, 22 Nov 2019 09:45:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574444741; cv=none; d=google.com; s=arc-20160816; b=gDBJN6Nykv5e44iVyqGobViBokcYmg6M0TPZEFAqNEXkbrH/lH/ZimOVFt8Z/JWTIb Cut9zoANOlgM7tsC+ETQDB1+ZjT3J3eOPbkOaNKPJonMg6aCTdx0BUegoeUI0NauqvxR n4Oib/YR/22g5g3zVC4B+JZUua1Rrk0/AOt1gzGcaGg8YofxDZuDET+iX9xdfUGq8WLv wAVB+wF/usdEQ4V7zWJ24vBuvevscrhOczgS/2lEKtS17OVgFIzqNFwHPPztZxPWm9X2 BUbQIBYl5IDXJiraEXB3FTbtX0TISC8EdcjQtFNoJ1uyfEK4S+bxDgSBn5dft2HAovcE k+Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=h56fbOK3LHFOKb7PeCUiHytHW+/rGe2pqRatOmUTizE=; b=CCIqR7KBa7WGq1w3gM+PU4XvPZIDlbwHqM98uU7YgmcEDyACMCAsOIMpcmZPyLrbwH UnevaPaTOL3ZmLZluC4xOvfS1U0w1sWmYe232HJVQm5VUfFM+Jq5K3uEP2/o4B5vUj8h Js9L8z9+K2XwRmdEohuI8Szq4o5j/CCzTszT3U4UfQZDDVlwCmqkLtB714SmiAuRTN5S Pizpa3GjcNThkET5Gjiq+gnhlaooDbe7RdaHuYzEX3ltwKZ67LBvam+8SdmETHT7i2Uf X7P7i+M2/UJ0zxpKUwn7H2C1k/HxibRUQPdhxg2xSL+Xpo3yacSQYbCm64ysZLBgemvJ dNGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BAjnLsTn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si4348704ejd.109.2019.11.22.09.45.18; Fri, 22 Nov 2019 09:45:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BAjnLsTn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726905AbfKVRoB (ORCPT + 99 others); Fri, 22 Nov 2019 12:44:01 -0500 Received: from mail-il1-f194.google.com ([209.85.166.194]:40743 "EHLO mail-il1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbfKVRoA (ORCPT ); Fri, 22 Nov 2019 12:44:00 -0500 Received: by mail-il1-f194.google.com with SMTP id v17so3839663ilg.7 for ; Fri, 22 Nov 2019 09:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=h56fbOK3LHFOKb7PeCUiHytHW+/rGe2pqRatOmUTizE=; b=BAjnLsTnSFBrVpp7SbyUz3Wk9Is7kL28zcQMGo2DO7JYFVPuoJBIHxIG1/OubuirXN Mu71/CxnBI1G0V+RFU9nkxqlM2Tai34cHtWlnP/GgBN8qmEOTPbOfAqz586TaKblpcsN XqBFi33fpuTJB+gHo82418deD2vILz1OKzqMRIBcjdKtt8T55P8Hc8T5F5OTkAivenPq 5852UBtaEqRqJXOhqu4eTtlPMzFEK08llX6LHvDiUCF2dsMATTIOMPuCxqRUupwRb/5+ dyzqwFOzXIVUJBbH1sJFcD4/RYl/zp72F0dGnF+XxsjpjIt5uTI4QyGUj9iMUGvZuB2V /Hqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=h56fbOK3LHFOKb7PeCUiHytHW+/rGe2pqRatOmUTizE=; b=nieDOMHsznqFVrNx4AmC53sAOBN6foiMDM9DEk/ea1BHbeS4THKcnekz+dfbeImi3h tf/ktIGqTsEQO0GOzUurHAzrLx2fUIh2ezaR0WwWwnXKsTE+pvQesUda+vTFdsrBTZGz MaOmK+Y6il13v43tFQWVEYXqskJ68qmh33PgiOihDpW+FZvHjAnMQkVLkIotbo4KIo07 DAVTkHQKKe4ETfJw/iENRkVr1OaYda95wSSidNcLhMtuFErztvUHvqfW3S0JUILxJsiM bH5iihVJGaU5e7H0Vn6Lfn3x6gk5pB/x5WP05V8/AqcbdvDue9ha3Cx7jWMGNx65ZpS1 VVKw== X-Gm-Message-State: APjAAAU99TXtRql/mWt+Nt0tdAHTjxNQm99g9NYarUByBiCnyeBgqI5v TW8AcxkBLRpaFuvh5pS3706XlUylgdT5y+EZ00A= X-Received: by 2002:a92:3b0c:: with SMTP id i12mr16763619ila.190.1574444639533; Fri, 22 Nov 2019 09:43:59 -0800 (PST) MIME-Version: 1.0 References: <20191004190938.15353-1-navid.emamdoost@gmail.com> <20191122072239.dhbhi2uawoqsclwy@pengutronix.de> In-Reply-To: <20191122072239.dhbhi2uawoqsclwy@pengutronix.de> From: Navid Emamdoost Date: Fri, 22 Nov 2019 11:43:48 -0600 Message-ID: Subject: Re: [PATCH] drm/imx: fix memory leak in imx_pd_bind To: Marco Felsch Cc: Philipp Zabel , David Airlie , Daniel Vetter , Sascha Hauer , Shawn Guo , Fabio Estevam , LKML , dri-devel@lists.freedesktop.org, Navid Emamdoost , NXP Linux Team , Pengutronix Kernel Team , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for the update. On Fri, Nov 22, 2019 at 1:22 AM Marco Felsch wrote: > > Hi Navid, > > On 19-11-21 12:31, Navid Emamdoost wrote: > > On Fri, Oct 4, 2019 at 2:09 PM Navid Emamdoost > > wrote: > > > > > > In imx_pd_bind, the duplicated memory for imxpd->edid via kmemdup should > > > be released in drm_of_find_panel_or_bridge or imx_pd_register fail. > > > > > > Fixes: ebc944613567 ("drm: convert drivers to use drm_of_find_panel_or_bridge") > > > Fixes: 19022aaae677 ("staging: drm/imx: Add parallel display support") > > > Signed-off-by: Navid Emamdoost > > > --- > > > > Would you please review this patch? > > > > Thanks, > > I currently work on the drm/imx driver(s) to avoid errors like [1]. > Hopefully I have a working version till next week. There I fixed this > issue by using the devm_kmemdup() and dropped the explicit kfree() > within unbind(). > > [1] https://www.spinics.net/lists/dri-devel/msg189388.html > > Regards, > Marco > > > > > > drivers/gpu/drm/imx/parallel-display.c | 8 ++++++-- > > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c > > > index e7ce17503ae1..9522d2cb0ad5 100644 > > > --- a/drivers/gpu/drm/imx/parallel-display.c > > > +++ b/drivers/gpu/drm/imx/parallel-display.c > > > @@ -227,14 +227,18 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) > > > > > > /* port@1 is the output port */ > > > ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, &imxpd->bridge); > > > - if (ret && ret != -ENODEV) > > > + if (ret && ret != -ENODEV) { > > > + kfree(imxpd->edid); > > > return ret; > > > + } > > > > > > imxpd->dev = dev; > > > > > > ret = imx_pd_register(drm, imxpd); > > > - if (ret) > > > + if (ret) { > > > + kfree(imxpd->edid); > > > return ret; > > > + } > > > > > > dev_set_drvdata(dev, imxpd); > > > > > > -- > > > 2.17.1 > > > > > > > > > -- > > Navid. > > > > > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- Navid.