Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3091163rwb; Mon, 15 Aug 2022 17:54:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Fe0K6NTKUhCQ3ZxnNTypylxoQD0D2VbB8nBtti1l44T7363FttV3HM6Sc0E6Pptrt11wu X-Received: by 2002:a05:6402:1d51:b0:41f:cf6c:35a5 with SMTP id dz17-20020a0564021d5100b0041fcf6c35a5mr17117385edb.25.1660611285362; Mon, 15 Aug 2022 17:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611285; cv=none; d=google.com; s=arc-20160816; b=GSqNilEA8RWdvFI4Dzms/wYZbCfNZRax6qkfxW3fxhM+rbDEMDJPMQDgmup25lIhWz iOk540DfKypDO/o6oJs7AG3rBxf9y9pGwRC0h/qjUSVXxSNjfall3pc6TkGFQKhWb3YP 7ttm92fAgAlO6c7Z2DebKftvbjngZE0Nm8r8yspfN0ENTZTAxu6zkjtXhd5b5MQS/BdH N/tfHXnrBYjY38puxMATIjcTVz8GAONsb5a4PyDJgUaMWYC4OhuHsrbrTEcKQWEJQgEc Lr4qeCK+dLo7JliL5mpAcosrMGSMOfmcuaC5/tHEbcSDV6Xd6BHD3nyTbKUCZheBionk x5Fg== 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=vckbHnFyWqQ9GZ6SLjZuJpOPmeqvJoY5gqc+2zpNVWvgjJYlceF7U1TAS2Kgem1pcF zEsA2VzF3/r59qtdiXwNumHwYAMtSyjmAiA+WH9/4J8k18fREFJTRtEAEdPLsO7slf/+ AbSz6PuuB5oxheakL3Q32c6bEtf0NTfBc99S0S5+BNzB8zSpHLR+/17vDHZkZCFbmIZ5 nBh69xcCXp4HFw8jAOp1axrrCDJ96nA6Xh2Kul+tobcozxMclJFe79/3jto+N66vnd2X z7Brkmbih+X2i+mQrGp/J+eZHW0ryZPof7xjIQh1MDmoRC8uaJQLaAK64WJVA8C/WYFw 69tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YgIXnLy7; 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 sc20-20020a1709078a1400b007317ef97240si7828210ejc.236.2022.08.15.17.54.19; Mon, 15 Aug 2022 17:54:45 -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=YgIXnLy7; 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 S1352357AbiHOXFX (ORCPT + 99 others); Mon, 15 Aug 2022 19:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352556AbiHOXDP (ORCPT ); Mon, 15 Aug 2022 19:03:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B99E86079; Mon, 15 Aug 2022 12:58:23 -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 8E82061299; Mon, 15 Aug 2022 19:58:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91773C433D6; Mon, 15 Aug 2022 19:58:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593502; bh=T8AMqL1bI2nByzhLxcyPhAwx+e3draOCLCZ86QLTzuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YgIXnLy7FYoeYMmQiQKwo1HPEf0+qazu5SguwX/ar3mm6zFYbYQpDDYdfdAI9Dvj9 f2FRw29D3t2Aq3jlOknQhdQ36gJSRSYtOQoeeZu9UwMWsmA6P29yMO9KfqagChqUXK QK//K8tVlJEOl9y7Cip+Hq7OmzlhJgfKC21ErpoE= 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.19 0242/1157] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register Date: Mon, 15 Aug 2022 19:53:18 +0200 Message-Id: <20220815180449.244074137@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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