From patchwork Wed Jun 1 08:09:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 12866484 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55CF9C433EF for ; Wed, 1 Jun 2022 08:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=g26cwICCjpEU6ooxPOyEhz72LrR1nPdjS7btoL+ytDM=; b=GMfLFaH/6g4k1A yFzV92BoHoOSy3en/c+V0Qv7bT6JyypF7YWIUgHRMIX2GBrlqGTcHdcjTJtZgvfJo7LWXyQKj8Mhz W41zvIKQ+9GCiS+d9tEjUoRcb1pnRYXOsZOFGCyDJ/pSnPRNS0VzW2e3AgDPcN9QV37LymgptWAzp ZVt7zAW7EgzGI6x474WozDEgO2xP/TrggMTnjPe7VR3k0Zizkw3Oir4975FxbMXbiIhJc+a0putyM fGwn04EhYTeehQoWEcR63vHpxNZA2hZNVwu5yuIfB4430NR28RXsb10G1jmKTOuv4DDDLXsZL6Igu QxpxbEWkb9rzK4lKGmHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwJSz-00EY7i-Or; Wed, 01 Jun 2022 08:12:33 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwJSd-00EXwT-9W for linux-arm-kernel@lists.infradead.org; Wed, 01 Jun 2022 08:12:12 +0000 Received: by mail-pf1-x430.google.com with SMTP id 187so1269841pfu.9 for ; Wed, 01 Jun 2022 01:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yDHLNk2lC1y820Hnctg510Z3pMFH42mdXU5O+qRYKas=; b=arrmauLcCxQndylaqkIA9fZ0VPxT810s39+vQWP3F3WnNMGOPYnIZ3hBSdBdD3B4Ej s4prptJWPl5/vqxaSc/fUl7y70PfQACoZzJj61xE4n30EZTA4BV4Bi6r8rZ/YZOu10m5 IEZQNt7MGu79BotcQeQ/3OQzBG4QJ8dSxtfWeYoOJErGMKP2lkkn/N/yB8RJtvRUYDZ5 G181GMNlHoon+ht/Fm5HLrPRYysHkMFSa+cVNFwoaiNsnh4ZXRZhEBAyIpvUf4L4w7YP A2EWDdpUHRMH0407FM/jMRqzvQ6HA4EzsmKSWiTwENCwBvriwJau1SMYxSfaign62Kae LL0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yDHLNk2lC1y820Hnctg510Z3pMFH42mdXU5O+qRYKas=; b=2px+b6I27SaFS/TuFTcRR0NVfNTPIPKiHTO71lAp/Apss+R4uOmNie7EAY1j/tLHKx u2+g8124I+Gvhfg323VrAcQZ6QA+/X9iYOS5smaZyrzWJzix+Cv1gcorzSEwi54zkr7j B/QLHm/mOgvclo0+sbG36Rc0UOMXuT8pTNpDoZvXUxoVi259XQLtbuw7Jz57geYNlIhF nP7IRWgi8ZD9CTwNTZ5xddMAcCVhtmdAy5dJP72ZYiHnecDeO/fnDhPUquxsUynfB73I UMWigMKIhGWtz1CxOo/k7yE5nifPNvZ1Hx3jEB5gvLG+9vU1DQqbxnBIw78JtLqU5PZa 3auQ== X-Gm-Message-State: AOAM531thpyqCYAD3ddcZXAjHU5m2AMe+3U1AgIb1tgCG4A6ni/oNDQV RKJRXnqTtGs6HXyjjLr4e/s= X-Google-Smtp-Source: ABdhPJw4BidUZQTAmV3LJkHDKE7X1qt6fzaWbucahjUCngpbzdX11O/YdU3Uf72mxrMRfIb6Tt5WQA== X-Received: by 2002:a63:69c5:0:b0:3fb:a606:819a with SMTP id e188-20020a6369c5000000b003fba606819amr22251860pgc.81.1654071126469; Wed, 01 Jun 2022 01:12:06 -0700 (PDT) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id y1-20020a17090ad0c100b001e2f3831102sm792288pjw.17.2022.06.01.01.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 01:12:05 -0700 (PDT) From: Miaoqian Lin To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Thomas Gleixner , Marc Zyngier , Linus Walleij , Birger Koblitz , John Crispin , Bert Vermeulen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Miaoqian Lin Subject: [PATCH 5/6] irqchip/gic-v3: Fix refcount leak in gic_populate_ppi_partitions Date: Wed, 1 Jun 2022 12:09:29 +0400 Message-Id: <20220601080930.31005-6-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601080930.31005-1-linmq006@gmail.com> References: <20220601080930.31005-1-linmq006@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220601_011211_377014_2E991819 X-CRM114-Status: GOOD ( 15.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: e3825ba1af3a ("irqchip/gic-v3: Add support for partitioned PPIs") Signed-off-by: Miaoqian Lin --- drivers/irqchip/irq-gic-v3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 1d5b4755a27e..5c1cf907ee68 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -1973,12 +1973,15 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node) continue; cpu = of_cpu_node_to_id(cpu_node); - if (WARN_ON(cpu < 0)) + if (WARN_ON(cpu < 0)) { + of_node_put(cpu_node); continue; + } pr_cont("%pOF[%d] ", cpu_node, cpu); cpumask_set_cpu(cpu, &part->mask); + of_node_put(cpu_node); } pr_cont("}\n");