Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2927190rwb; Mon, 15 Aug 2022 14:12:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR7sB1orWK6YQdk6xZTYCB6nb5uv3Ye9/RMcM/1G0VyqythZLaVgVzt5kkdSNMtKIwUi/VCb X-Received: by 2002:a17:902:7682:b0:170:a235:b5a2 with SMTP id m2-20020a170902768200b00170a235b5a2mr18853657pll.113.1660597956423; Mon, 15 Aug 2022 14:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597956; cv=none; d=google.com; s=arc-20160816; b=Nh7seV17RV4tsD0+ObpHo0iKpwxNMJ7hPErkbZE5hsU3QJIPXA0kTu7pyXy9PkPlzc YuJj/BMpgIXfIAkjQ8WtByv1X1TxEwO8yelBgX72t9/YZs5KbzGXk2ap7527C9UYTna+ TgFqkR3ocVh1Dx+zL2nWN0jPkRC4ikrT2hh7huT8K2WSRJilbYNk9RI/soXfY7PmBOAI EMWAdKJlbZNhmM8KgieLmt4mKV6ZNifugBXGJzp/tZbIFTWgmG+4n9kQhMxzChSc0FgK Cp11uDghHO24tY0pihoTPBUsYz1z2FHgmiTl54IbQ0+K79mHfhS95RCpe40eeDoA2OpK g00Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6T1lfgW/Xq1xQwZTfxtDOFBBcwCMfNstXxOiapzjNx4=; b=DzmvzwnKh9zQUtVpr6HjUaUA/b+mEHmpJIRGftlDY+KFIRUe39I+0/mQhnuORqZupd 0Pa/C6wpObsRzblpe3hrTrocXPNi3TU/qIygpWaW5P5/uqNdCr+KYYNwxVs/REnlX+JW nCSPyZoiBHXDRx+cmA3rfnAuNcJvSQccz/7omGyxF1RzzVVsDocbvI2CX/8zJVE87tD3 1vUmSLc/1ciVAZ7JB1K9HVXgyOhdSok02sIEfSesW31XupH84YISbiZBBzSfDNA8lGx3 EwNUrH9Kpl3yzTCTNfVqvkP49izGdxJ3fjsPd+4dk3NkXHbp1/mZ+sMTEIqF/i2oxqg5 SZtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n78bBB+1; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a056a00230600b0052e7d706a6fsi10982652pfh.149.2022.08.15.14.12.24; Mon, 15 Aug 2022 14:12:36 -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=@linuxfoundation.org header.s=korg header.b=n78bBB+1; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345909AbiHOUkk (ORCPT + 99 others); Mon, 15 Aug 2022 16:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345000AbiHOUfY (ORCPT ); Mon, 15 Aug 2022 16:35:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69AF52AE39; Mon, 15 Aug 2022 12:06:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0865261281; Mon, 15 Aug 2022 19:06:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A715C433D6; Mon, 15 Aug 2022 19:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590390; bh=T8AMqL1bI2nByzhLxcyPhAwx+e3draOCLCZ86QLTzuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n78bBB+13YmSCJc/oii4UF4Fi9lwYLpsG4q8ro2RdLZjwuSsuQpm8efkpK7nj7BdX NF41+A11qlTjxT8MXOH01200lIaJgSsvV+idfkn70t4hKOnk/OeSzb9lKvhL6b4G27 ftRH2g3nqf+a4BwTO3XgxF0KWan0u1HqX8ajrbHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.18 0245/1095] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register Date: Mon, 15 Aug 2022 19:54:04 +0200 Message-Id: <20220815180439.925219341@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Miaoqian Lin [ Upstream commit e6e0951414a314e7db3e9e24fd924b3e15515288 ] Every iteration of for_each_available_child_of_node() decrements the reference count of the previous node. When breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node. Add missing of_node_put() to avoid refcount leak. Fixes: 05589b30b21a ("soc: qcom: Extend AOSS QMP driver to support resources that are used to wake up the SoC.") Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220606064252.42595-1-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/soc/qcom/qcom_aoss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index a59bb34e5eba..18c856056475 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -399,8 +399,10 @@ static int qmp_cooling_devices_register(struct qmp *qmp) continue; ret = qmp_cooling_device_add(qmp, &qmp->cooling_devs[count++], child); - if (ret) + if (ret) { + of_node_put(child); goto unroll; + } } if (!count) -- 2.35.1