Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1863107rwb; Fri, 19 Aug 2022 10:38:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ZuI/SzKX3GMdN3Eu8bITik/Rr6/ag5VjF6jiiEDN6+f7NDkBrCnjxPTG5iNHzvtKNAWht X-Received: by 2002:a17:902:8c92:b0:170:aff6:e3a0 with SMTP id t18-20020a1709028c9200b00170aff6e3a0mr8499309plo.54.1660930680984; Fri, 19 Aug 2022 10:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930680; cv=none; d=google.com; s=arc-20160816; b=POcps0WxGvUwZuGTLH7s10k6SSvoD17xWXhK0d9FUTCV28YWhVg4LiqFvT+rIrqnTZ gXQkKszfGgKLBh/0pbfhxi9nEcntK4NXIsRNxNYDIGTiAbvH5dImZNzEg5L2iUHN5yQ2 NM7ykpOpmdhgdpji9iLPZh0EdGiIh1lVBkmeY+xiUhjXYCG15ik3lhQYqx1Kl2xOM5aY rFghxPpfo3JOCMusqLElgVBbUikCCLYGgI5AveMTxXYiRgX3MKsSDR9u28X2sA7Y01pT E3spFO1uJcceTgVjALCtq1tUDpiNGvJB8AREk3U8wNqOMNK9pjU4hwikh9YPjbd/+OUB 7Pag== 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=WSduwfFEpjFarcdo2DjlbvjLiB6hUIJtGelAKjoE40w=; b=VcUaKfmJc0w0y4SK5T9XESh9bX71qyT8d13AfRXYpG4oK9D7TOuGt7lDJr7rwRoRq/ ZLBjESitmoI8EUHzVFAzaxBk9H0bFQF8Q950IPCs7OP34VvzIdBR9fzcQhKsHBhgNSg8 BM6kdGe57Nq2eaG0imlu0vuJOmUXtKEmAa2zxQMzto+bhP0KxcQuqjFI2IDVwwy0uhfe 9DecJM8k5txMfWKRxzVbxiH52M6iXPkMOS+GBr3qAQb72bWhnV5V1nE3YeNkepfh+tVJ nxUEBg9yzt5lu0mC02TYGRYClN92eFrzYHKH88mueyVs1ISTQiH4PNsR3VaWwPifPwCX KphA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0ffk7MC1; 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 23-20020a17090a199700b001f13ceaa2e8si6619999pji.65.2022.08.19.10.37.49; Fri, 19 Aug 2022 10:38:00 -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=0ffk7MC1; 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 S1351145AbiHSQDW (ORCPT + 99 others); Fri, 19 Aug 2022 12:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351118AbiHSQAn (ORCPT ); Fri, 19 Aug 2022 12:00:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D60649B75; Fri, 19 Aug 2022 08:52: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 AB396615E9; Fri, 19 Aug 2022 15:52:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B48B2C433C1; Fri, 19 Aug 2022 15:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924325; bh=Hp1dkGzsLKhbd6JiKMgEQvwajSh0f8J5uvcz+zEZevM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ffk7MC103G9N821p6getTyWaswBlFCG3SDxNeFnjiH/vJyIpTd5QNkpzuQhLggd1 IJM0uTXVIPcce+9k6aAP3QEHs/4BNtRTiqFs9C8UbMdSBlZDXHsut0jiYn9Km1IhWQ M01qbmXSpQ3QWrFVdyBR4nrXLRaghaYDxyNZs7Ck= 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.10 133/545] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register Date: Fri, 19 Aug 2022 17:38:23 +0200 Message-Id: <20220819153835.286935073@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 941499b11758..401a0be3675a 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -493,8 +493,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