Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52372C3404C for ; Tue, 18 Feb 2020 21:03:27 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 233FD24656 for ; Tue, 18 Feb 2020 21:03:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Vi8WvkiH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 233FD24656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4C30410FC33FD; Tue, 18 Feb 2020 13:04:17 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=205.139.110.61; helo=us-smtp-delivery-1.mimecast.com; envelope-from=jmoyer@redhat.com; receiver= Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B6AD310FC33EE for ; Tue, 18 Feb 2020 13:04:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582059802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Vvczn1/7WH5ejB4qaPLsHmvxrtLN/Bp15yKQpp7R6F0=; b=Vi8WvkiHr6A2v12fdCr8wYyXZvdEijuW8Z70A3JeQH/kSwP7zw+36kpIdCTDziFzhr1eH+ j6O9kcufSMA99jZUhSva1lfcTWZpyqPP7Q/38peHi63uM0P9m1TFCEWpJEQ8DjKbqCEdJY w9/1zO/YdK0q2wGGFvUuiYZBxSl0kFE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-418-c49ZyBenPCSX0r2KfBpWTg-1; Tue, 18 Feb 2020 16:03:15 -0500 X-MC-Unique: c49ZyBenPCSX0r2KfBpWTg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EC5FE107ACC4; Tue, 18 Feb 2020 21:03:13 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C5C819E9C; Tue, 18 Feb 2020 21:03:13 +0000 (UTC) From: Jeff Moyer To: Vaibhav Jain Subject: Re: [PATCH] libnvdimm/of_pmem: Fix leaking bus_desc.provider_name in some paths References: <20200123031847.149325-1-vaibhav@linux.ibm.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 Date: Tue, 18 Feb 2020 16:03:12 -0500 In-Reply-To: <20200123031847.149325-1-vaibhav@linux.ibm.com> (Vaibhav Jain's message of "Thu, 23 Jan 2020 08:48:47 +0530") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Message-ID-Hash: XB7NCXOXRFI6I3NNUNM4BQHVJ5XLTRX5 X-Message-ID-Hash: XB7NCXOXRFI6I3NNUNM4BQHVJ5XLTRX5 X-MailFrom: jmoyer@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: linuxppc-dev@lists.ozlabs.org, linux-nvdimm@lists.01.org, "Aneesh Kumar K . V" , stable@vger.kernel.org X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Vaibhav Jain writes: > String 'bus_desc.provider_name' allocated inside > of_pmem_region_probe() will leak in case call to nvdimm_bus_register() > fails or when of_pmem_region_remove() is called. > > This minor patch ensures that 'bus_desc.provider_name' is freed in > error path for of_pmem_region_probe() as well as in > of_pmem_region_remove(). > > Cc: stable@vger.kernel.org > Fixes:49bddc73d15c2("libnvdimm/of_pmem: Provide a unique name for bus provider") > Signed-off-by: Vaibhav Jain > --- > 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 8224d1431ea9..9cb76f9837ad 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; > } > @@ -81,6 +82,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; Reviewed-by: Jeff Moyer _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org