Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2815643rwb; Mon, 15 Aug 2022 11:55:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ch0I7Co3QRnQPjYS26M0LbG9B+++j2FSbLX21caGgsx4skVP64Lcyqi79+VJyESWVWIjQ X-Received: by 2002:a17:906:974f:b0:738:4839:4eeb with SMTP id o15-20020a170906974f00b0073848394eebmr4571082ejy.103.1660589734479; Mon, 15 Aug 2022 11:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660589734; cv=none; d=google.com; s=arc-20160816; b=gObSNKjYYm5WLGRdPJAY49BKLNyu118idgo3PT9Vh2xc2RRGLZb5f1kUZJC9sRL61H 2+gKGepwWJ9BAQxCfVw+mQqxULElmRpJ1qqKDQLiyNPS24tQ6jhrlEMP2bHomd0T2m70 eRu8HJHUs66OJOnw0GVsN1srfL6U8nVAxCQK1PDEQ5S32psYMZmuND0MWoXm/+P8b4fc +JkmSvy9NOegHthaiSQA8YP82UdT2nwZGxc0l5rGIUDWs6Q9Br3jZ0U6onyoRjDZVcmU 8biaJAGGxEWA8HfUT1W4noEAGzOF+8eLSzN2fnWnpVkj4lh4OUNAGcuYmHZgjZ+4fdMT oZxw== 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=xozNYaHFWfJua+4hfuaJH91MiNDX/l4gtExkGS/xjBU=; b=SL5xJQiYEJWKXsRa3KMRUO9o8woLIVxfRhezabCc3phzzMoo4COpZ71H5pl2qsa6gd P8YtQ9dfyrLgqUCId3uztzdXYfvyUTbkndCWAApN5NanlIyExajCU9nIiqG6T33BgOgQ 3zPSxrSRZM9QVn9xhPJVaejttzc1nRNpGOBjpytRb66RRcDgHTH9dTOkRD5FKFSLxlXg tiDOIYcKcgSDqtoMrM+6I4urFkDavEbl8KAmebhTQMfUPcyzo2zeg4yNyJcZNlQMgydP hSCTzKXodvfVKGBd9lMzg3caYfxFdKFqe22ajZkzkDpY+l6b5hCAjfM4tsft084iQ97B vsUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=01lXly8A; 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 gg14-20020a170906e28e00b0073860fbb197si1198702ejb.221.2022.08.15.11.55.04; Mon, 15 Aug 2022 11:55:34 -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=01lXly8A; 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 S243167AbiHOSn2 (ORCPT + 99 others); Mon, 15 Aug 2022 14:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243407AbiHOSk7 (ORCPT ); Mon, 15 Aug 2022 14:40:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E393A3ED53; Mon, 15 Aug 2022 11:24:37 -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 ams.source.kernel.org (Postfix) with ESMTPS id 227C8B8107D; Mon, 15 Aug 2022 18:24:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FC03C433D7; Mon, 15 Aug 2022 18:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587874; bh=+71B/xPyFSD04nyum0BVG7RUBcf5hzJg6Y5VERD+m2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=01lXly8A2LksSkgcEHPb4urPXLojuUfGToRzo3X7ukzSiw8mRhKe5JMZO8YMKZLgK H3aemthWan458BvFLkFAn7/xGYVb2tC2N9s6X4lH+dPi8qyO+xCM7wn7yPnfFvCwk1 OM0yRGzNq142yhvr+ZYf+wXudkKR34MXuPa3JIZA= 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.15 191/779] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register Date: Mon, 15 Aug 2022 19:57:15 +0200 Message-Id: <20220815180345.413523594@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 8583c1e558ae..3973accdc982 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -499,8 +499,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