Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp148032pxa; Tue, 18 Aug 2020 19:11:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/QuQUr7dVIf3fcxgHZeY2vQcIPVrjNMIlnHtCPqMgffTbgzNri3LU3mjCfc6YJS6GxgAF X-Received: by 2002:a17:906:3b97:: with SMTP id u23mr23974054ejf.31.1597803085192; Tue, 18 Aug 2020 19:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597803085; cv=none; d=google.com; s=arc-20160816; b=x5MRC00+osvO5bO1Ol3oZ2p+LbQjiEhVyGi7fJmKGM93ohVWlW2YmhdZKJvYQd+qlx dAYIsGslWeHOxz4ZBrCrTcZsgF82xUA3d8CJ+o/7Ab8GZJq5UnVoVNmw/+3Lt+1G+K+K T7Pavr9K0LN/X0U9gnQ4aBR+DB91lTSWcRqG8L2d0q3RH+x28yZbY4vXLVRSxTcT+GWb 51WOeWxwpEwaCvmGqqBl25LC5hQmlHMTIZ/fHwVV6VSC4APhOSvQHrHCKeAY+l8kSKcm ks3Uj65Q/kkd1Lr/pRveGXqBrdPIEqwiEpAcYF1sXFuGgFzVeUWpMIQo1S6DrZIJftUg hUzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Qo7AAoocP9HABafDfcw67drWao0aZVb9hNvRf97QPJ0=; b=RSNRp+FISgTG4riXe48cjgwM0CLx/OiUh1lPXN7NulQ6VA87kplGWOL/lT3Wo8D3Qi LrFpMfJqCw9zNixQh8qpfQF5LBoBRXc8n+82W9B6ds0qyXhq5okxxS6BO0qJkKEzbiZt qZB0IC2bse4e1Li214PtOhyLyxTO7YfasUbrE1+mmEyTqywe69FRiZ3NV0D0jGmKGtDh 8qsKri9HdCAbYudl83zQ1qNprk8PWcBJlgOltqjgGAoOpD6EtGUOYhFTdkY5D8z5p6R4 v0EoScHNjaVjhCWO517DjScij+cK2H6V1LayWtI55Fdv0Ic5a78FMQjm+td4vsMSMkzZ f1yQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z22si15476767ejl.459.2020.08.18.19.11.01; Tue, 18 Aug 2020 19:11:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726841AbgHSCFq (ORCPT + 99 others); Tue, 18 Aug 2020 22:05:46 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:53810 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726681AbgHSCFp (ORCPT ); Tue, 18 Aug 2020 22:05:45 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A5B98752E57501560590; Wed, 19 Aug 2020 10:05:44 +0800 (CST) Received: from DESKTOP-C3MD9UG.china.huawei.com (10.174.177.253) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Wed, 19 Aug 2020 10:05:33 +0800 From: Zhen Lei To: Oliver O'Halloran , Dan Williams , Vishal Verma , "Dave Jiang" , Ira Weiny , Markus Elfring , linux-nvdimm , linux-kernel CC: Zhen Lei Subject: [PATCH v2 1/4] libnvdimm: fix memmory leaks in of_pmem.c Date: Wed, 19 Aug 2020 10:05:00 +0800 Message-ID: <20200819020503.3079-2-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20200819020503.3079-1-thunder.leizhen@huawei.com> References: <20200819020503.3079-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.177.253] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The memory priv->bus_desc.provider_name allocated by kstrdup() is not freed correctly. Fixes: 49bddc73d15c ("libnvdimm/of_pmem: Provide a unique name for bus provider") Signed-off-by: Zhen Lei --- drivers/nvdimm/of_pmem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c index 10dbdcdfb9ce913..1292ffca7b2ecc0 100644 --- a/drivers/nvdimm/of_pmem.c +++ b/drivers/nvdimm/of_pmem.c @@ -36,6 +36,7 @@ static int of_pmem_region_probe(struct platform_device *pdev) priv->bus = bus = nvdimm_bus_register(&pdev->dev, &priv->bus_desc); if (!bus) { + kfree(priv->bus_desc.provider_name); kfree(priv); return -ENODEV; } @@ -83,6 +84,7 @@ static int of_pmem_region_remove(struct platform_device *pdev) struct of_pmem_private *priv = platform_get_drvdata(pdev); nvdimm_bus_unregister(priv->bus); + kfree(priv->bus_desc.provider_name); kfree(priv); return 0; -- 1.8.3