Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1350466iog; Sat, 18 Jun 2022 07:14:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1swnyid0nnX09Crr9T+BwQjLgPTExzM9NL7v8vlV2ZbdcDqvAez8e2GEsq0Mx1ngtnXCZnx X-Received: by 2002:a17:902:ed8e:b0:16a:147b:9044 with SMTP id e14-20020a170902ed8e00b0016a147b9044mr1627687plj.85.1655561658272; Sat, 18 Jun 2022 07:14:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655561658; cv=none; d=google.com; s=arc-20160816; b=jdhflZiWjlskUPnfBKcYt5Ri6OAC7PIcJ4h4zixTq20Ti4nt4AuihVrMKQdF1IGkXx X8le8JSjjU43SudPRUU/u6k30huFQ4+nVpGv22bKOWtxHEGIgb3oXdC65vL4suAgC7hv daVxI7JKtF8LNGwoHmLTnNf7M+SVNbv2rOYaqhPt3fGc4+mzAlvuEJQy32S+6DobIiZi br6d7Ap9IXXe8u7KwR48t6wnRDld1S0CUmoAO2/xaiUWla12Icsamg1RIWdQiyXQQPuh es1Iu4nShzg4mEvYBrvuPwOg86fAbYx8muksc3XUN9dm1f7bulo0MzP5kAhcQIJGekVI oIiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=ow8g3o4z79Y5Cr2CRU5IK8a4Nx81Y5TgND6Vb+EHq2A=; b=0aq/gt29QIqvGErFJ0Dwu0Buz7IhyBYRDcJmRJZlurzFDea+2tYjRt629oDO2iM7g+ 3dRf3gRdhFkU8Ut3N8autxxfFPCPqN61svNUXTWZjZCTfiW5ug84pune8QvhgDCNVeeX fNrQTlSIG4E2KSPn4OSYopjVh5n5a02VHn6sYgqY+R8a7bAw4hvU+jEwIJw9SV1jIWAf t+ru13LW5dim9zX8M27NPZtxoD7Ko5iON+/gmOiNesTz9yzKa83L8UVOOdGO3htuF3mg 5PL1LPLwTjrL45DTbsCFrQsh6Eb24/2EOZHjbytBjlnWfupQTjdCqs9h5++kY4iRpMwY 0fDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=I2mm4Rlo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w16-20020a170902a71000b0015f0063568bsi8421131plq.340.2022.06.18.07.14.04; Sat, 18 Jun 2022 07:14:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=I2mm4Rlo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230469AbiFROKw (ORCPT + 99 others); Sat, 18 Jun 2022 10:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235386AbiFROKp (ORCPT ); Sat, 18 Jun 2022 10:10:45 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 124246371; Sat, 18 Jun 2022 07:10:44 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id z14so6419540pgh.0; Sat, 18 Jun 2022 07:10:44 -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=ow8g3o4z79Y5Cr2CRU5IK8a4Nx81Y5TgND6Vb+EHq2A=; b=I2mm4Rlo4JbRzZncPQX5K+A6VfD1WPz4umBSLloPa2vNlBf5n7u5e5Q8ck/n8xAcgT SBsy6yUmq4Nv/ftAlSnchjoAmeca+Hii490/4yQu/Q5CplEQnBwBbj1zpv4KDgJ/Xp0N qm0029PtaHAO1cp6pQf2xUdNQPQYXnSXdC/ivYthGppz2aHagL+qstK4OTw7siJoPBLI 6BTuTLNHMRMV/+e69E6JqGJov0BVUOHahFc31t6rDcW7tnFdboAtvd1pF+ySSVvyNXlI i0MkFeVBXo6cMdKv3b0tjXXRJKHMGNXdLBNNYjqUuiNQ/UVfzNsBQqCV1kaJSgYF+j9R sPCQ== 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=ow8g3o4z79Y5Cr2CRU5IK8a4Nx81Y5TgND6Vb+EHq2A=; b=4d+3IRIjr1aoDcuj2Ctg9ESv+tV0Y2GUZtZREv2l8COeahBTri8iXXSct4u6LC9l1z HPeREMYarbP3WzppjyBYuBpmHp+fg2JfJFfpJnNMATfvmBMAOhLNm2IjOlgvxQSp40K7 NivVkWm7DFjqEs/idkAnq8ENNfQBeThO/u3vLX/8VzdTS5qXCZiAXL0MV0i+xtuuaAhK 0OZlXPx3B1mo4/VCD4n152vorxC7vWFZUENZ7kmZwAxLnGbkcabL4eNhXkBVhSi4C58T 5E5/zfX3vZGbVzAoHOaj0+/TQ7qY1jZyt8dJcB2IL/GC+NHl1Ha2NSpQL9TujLiA+LLn Gmjg== X-Gm-Message-State: AJIora8OLND9aARDZcWJtiVafE/gXW5mYZ7novV0vZPTztnmYepZkzFa D3lBpCCRboy+VNzlZKSXxFA= X-Received: by 2002:a05:6a00:21c2:b0:4fa:914c:2c2b with SMTP id t2-20020a056a0021c200b004fa914c2c2bmr12088578pfj.56.1655561443391; Sat, 18 Jun 2022 07:10:43 -0700 (PDT) Received: from [172.30.1.37] ([14.32.163.5]) by smtp.gmail.com with ESMTPSA id j4-20020a62c504000000b00518a473265csm997780pfg.217.2022.06.18.07.10.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Jun 2022 07:10:42 -0700 (PDT) Message-ID: <1c9e0697-ff02-d678-f231-8a3bc2e6be6e@gmail.com> Date: Sat, 18 Jun 2022 23:10:37 +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> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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) { Applied it. Thanks. -- Best Regards, Samsung Electronics Chanwoo Choi