From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B2AE3C433EF for ; Sat, 18 Jun 2022 14:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NOsFnCvGsMb8lVLf52/YeQBis6x9tTdzcRBKq/CXsrg=; b=q3SJaicpLDiTg0 WeovnReL1MsCWdjr2eLCFooZ2nu0cTuqnxC3jrlbpys2Db3SbFZEqH71+kV9FK00XScfl+MgMYPBE QXztDjx9cjfqLdFUBMBg825U79kzPkrVdBPPNPWiAPzqgsvATeLc0p2CIqncILEbwiozMs91kqSuE BtXp+ML+hvbF22uPheLo23sjyKRdIlgNe3n2+nD+RO1CUeU0gfxc0jEJARfIEvVZdIKXvzPdHGYcQ T03aa/aIA1P6nL9K5a6GLRWxx767clLBTrm4rRf47m0pDlis9RgCqFZmpKoWobmDgvmtoCLMXenhh Oed/MzbpudpSHjT/HMQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2ZH9-00BW2H-PI; Sat, 18 Jun 2022 14:18:11 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2ZH7-00BW1W-39 for linux-arm-kernel@lists.infradead.org; Sat, 18 Jun 2022 14:18:10 +0000 Received: by mail-pf1-x42f.google.com with SMTP id z17so6491350pff.7 for ; Sat, 18 Jun 2022 07:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=QiBFbh7JSAwKD6sJ1nf5U4eu547oJ+ADx+EKgoymxCI=; b=ViprWoK4uqnklWzTQk+fvnLaUqne0Zd90H9MixB7tRue3RXJ8Lq9n5syAfKrS3dKEA HT9z787Xt3UAxhy1S57GgN8644M/bc8r4HbbCn0alGy0UzCj3DFJA1T/Ib9R/pOANPpD JEsZ9EU88xvA6ikZqDoFXIXdh9FSFoCuW2IvlKMA3sH/8/OtpizRHSwwmGCZD40FJel+ yPC0/gi37K8AK2vvZ9a4XDCnlRfqukBCue2IC14lDDNquYrNeKvjLkY6IeQ6lZRcNUCn kBjUOoESkgxJ2s2k7cHQTPgYxvOaK1XAtlHrK415aY/0iBlK8oX853OJJXj/Judkpbfd yk3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=QiBFbh7JSAwKD6sJ1nf5U4eu547oJ+ADx+EKgoymxCI=; b=YfkZ6pOGXkMtdOSAfTZ6VGy843CKjVzkJByzcWt4Z5ciMQ+hJbbwfkW6yyRptwINPk wEOrzEORRuwUnc/nzH1ZykE+ejG40cYuJWgGibeiVgMEv+PE+nQ9KgCISEUOd36x9nUm P95XNx8oTcWGgtegKWw9oYwYsOUP3PhJeGX0Txa4JzTYsjgTwL51C75HtHYdsGkMfv8V VJ0dLxDDggO0s+DbAeNRhIrpWoZPGDax75lIDQC1wwVZXb7K9jX4qA2rupCwZG7ZUbvG SeCp4KjQ66FH/n+zKJCHbFxTJR+5pty5QyLYSvdHuVStWMjIKk4BQ2iDdTudkrF/f/IO YBDQ== X-Gm-Message-State: AJIora9p+11cQYcsVqxUIFySR4VlrvhRjkBrRfAiFOBaaDRtchRiL4L+ excU6/Wd24th4h7ZNfo5Ojw= X-Google-Smtp-Source: AGRyM1u2mGmi1JJfkT6ExmYQ2dFty+U+or8nDWjHbWZLfPVYWKM8Lx0xSixycdUe6IskWv1L1zV22Q== X-Received: by 2002:a05:6a00:7d3:b0:51e:740f:8d10 with SMTP id n19-20020a056a0007d300b0051e740f8d10mr15348069pfu.4.1655561887511; Sat, 18 Jun 2022 07:18:07 -0700 (PDT) Received: from [172.30.1.37] ([14.32.163.5]) by smtp.gmail.com with ESMTPSA id b9-20020a170902650900b00168ba5ac8adsm5425678plk.163.2022.06.18.07.18.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Jun 2022 07:18:07 -0700 (PDT) Message-ID: <7bffaa3c-dda8-44f5-8190-9fb5142925bc@gmail.com> Date: Sat, 18 Jun 2022 23:18:02 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] devfreq: exynos-ppmu: Fix refcount leak in of_get_devfreq_events Content-Language: en-US To: Miaoqian Lin , Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220526082856.37594-1-linmq006@gmail.com> From: Chanwoo Choi In-Reply-To: <20220526082856.37594-1-linmq006@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220618_071809_199281_4E344CAE X-CRM114-Status: GOOD ( 20.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 22. 5. 26. 17:28, Miaoqian Lin wrote: > of_get_child_by_name() returns a node pointer with refcount > incremented, we should use of_node_put() on it when done. > This function only calls of_node_put() in normal path, > missing it in error paths. > Add missing of_node_put() to avoid refcount leak. > > Fixes: f262f28c1470 ("PM / devfreq: event: Add devfreq_event class") > Signed-off-by: Miaoqian Lin > --- > drivers/devfreq/event/exynos-ppmu.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c > index 9b849d781116..a443e7c42daf 100644 > --- a/drivers/devfreq/event/exynos-ppmu.c > +++ b/drivers/devfreq/event/exynos-ppmu.c > @@ -519,15 +519,19 @@ static int of_get_devfreq_events(struct device_node *np, > > count = of_get_child_count(events_np); > desc = devm_kcalloc(dev, count, sizeof(*desc), GFP_KERNEL); > - if (!desc) > + if (!desc) { > + of_node_put(events_np); > return -ENOMEM; > + } > info->num_events = count; > > of_id = of_match_device(exynos_ppmu_id_match, dev); > if (of_id) > info->ppmu_type = (enum exynos_ppmu_type)of_id->data; > - else > + else { > + of_node_put(events_np); > return -EINVAL; > + } > > j = 0; > for_each_child_of_node(events_np, node) { I edited the patch title with 'PM / ' prefix in order to keep the consistent style of title as following: PM / devfreq: exynos-ppmu: Fix refcount leak in of_get_devfreq_events -- Best Regards, Samsung Electronics Chanwoo Choi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel