From patchwork Sun Feb 5 11:29:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 52892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1737834wrn; Sun, 5 Feb 2023 03:36:00 -0800 (PST) X-Google-Smtp-Source: AK7set8kMVFaABg5jVpK8BRXzWQsNBVZID9CniaOm2aExWB3VgXmlHDdAfRG8gbfNM/v6Et6Nar5 X-Received: by 2002:a05:6a20:12cd:b0:b8:a56f:7612 with SMTP id v13-20020a056a2012cd00b000b8a56f7612mr21026548pzg.55.1675596959923; Sun, 05 Feb 2023 03:35:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675596959; cv=none; d=google.com; s=arc-20160816; b=fWW48vQ6Vz2FMXzrjiLpg3fbw5nIFkMu7gZ4ycQ448bKt02rrqcv1neFU1MNZyxtEe xb1DsjjroxUTojqep/OWBoEP+NMQ4j4VC7UR4ZuQCeWBN0EA7UyLKX4V4qRtlGVVKhTN KRj3Uk1qkdt+lA9JZAOfFLmwp2Qkhjs+WhM7Mbzr3K8+phzeElZRc6xiSeosDeV7OGCy pzqMtT0uipZzn5f5Fai92xkqCwXKXQI+wI9h0e/3VIh+CvJiNP9KuI4g1mPpAlavCN/E A6XXtfV3gHD4mA3oZ+oKJhuWbFrqihH/u7GXoJ4Mj5SgLxFH40RRcVjk3ruZdYhoXbNA WFmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=3SkofOjNSiZ12fXJsP1jQLpiw2VDynSl13FCW72Y/GU=; b=FYpr1ms6S5ZcqTQmyt3ynmnDNmwvK0MAp7+MfmG1vyfGAraGHSTBoVJFuN7BMulOGW u8fcl15tyILDbchtrKuvy2UT16jY8sWPvDdPEbXjJ9WLqLTz0D+xXwHgbJYJL4mkYwTX qRJNxdVYrwdqqDbpwOd6B8TW0BuwDjcaPami4FRIgZYN/xZ1cRIPYTwu75oAElF3egXS QVuLTom9kvxVDXJY0yI9Neu8hRXysfufohUnu+JE4pcNfW2dGx1l3HcsJm9DZuWEYP6v DzG9g602I+YjQDQK+TQx60iZxVJsMVGU+uTewhDB/0EA2oSAKkfkZKDA3cwJ/OTHcPO5 2dOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="SIbwI/pS"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=G3hSKLu5; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z76-20020a63334f000000b004daa13455ddsi7793092pgz.331.2023.02.05.03.35.47; Sun, 05 Feb 2023 03:35:59 -0800 (PST) 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=@linutronix.de header.s=2020 header.b="SIbwI/pS"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=G3hSKLu5; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229631AbjBELaI (ORCPT + 99 others); Sun, 5 Feb 2023 06:30:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbjBEL35 (ORCPT ); Sun, 5 Feb 2023 06:29:57 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC5C91E5FB for ; Sun, 5 Feb 2023 03:29:55 -0800 (PST) Date: Sun, 05 Feb 2023 11:29:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1675596593; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3SkofOjNSiZ12fXJsP1jQLpiw2VDynSl13FCW72Y/GU=; b=SIbwI/pSNKySK/ND9FBo70nNnmYO5doLOJLn+PoNLeyck0/6PwvKFNtbvtWGIN8fo3Ewwi Vz9aWGyvLrTcOHLPlm9GTEK4XatYanMVeIl6djyfQCXmL7L+664QSxiwpL96sWP3a7F/A9 wij4IzscVmwwRlYhz+aIRuCf3zGMrBBS8iVQvOY4jL+nxN/GQM404u17qpQDQDXzjtL2m/ 9GlkgqBQLRbXti1pbdZCz4JyuCeUwOMz89z/OCilowh4UlQb1QhZcdSoVrcPFMJ7fHCBL0 sbw7JzzA5s2/NgzGnlDvj4/IPrWCdvZcDIymvoqdiQ2Z0Q/9ktXAkLq8G/ba5Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1675596593; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3SkofOjNSiZ12fXJsP1jQLpiw2VDynSl13FCW72Y/GU=; b=G3hSKLu5C/KAvVkLTOO68RYZHaI+ukOto9LgdojLpmS5zbl39lQuI47BZE/LkDuR7zbgjj YJ5vTfdXheDKGkCA== From: "irqchip-bot for Miaoqian Lin" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-kernel@vger.kernel.org Subject: [irqchip: irq/irqchip-next] irqchip: Fix refcount leak in platform_irqchip_probe Cc: Miaoqian Lin , Marc Zyngier , tglx@linutronix.de In-Reply-To: <20230102121318.3990586-1-linmq006@gmail.com> References: <20230102121318.3990586-1-linmq006@gmail.com> MIME-Version: 1.0 Message-ID: <167559659356.4906.4509820163003208883.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753912866958873415?= X-GMAIL-MSGID: =?utf-8?q?1756990758129176576?= The following commit has been merged into the irq/irqchip-next branch of irqchip: Commit-ID: 6caa5a2b78f5f53c433d3a3781e53325da22f0ac Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/6caa5a2b78f5f53c433d3a3781e53325da22f0ac Author: Miaoqian Lin AuthorDate: Mon, 02 Jan 2023 16:13:18 +04:00 Committer: Marc Zyngier CommitterDate: Sun, 05 Feb 2023 11:07:52 irqchip: Fix refcount leak in platform_irqchip_probe of_irq_find_parent() returns a node pointer with refcount incremented, We should use of_node_put() on it when not needed anymore. Add missing of_node_put() to avoid refcount leak. Fixes: f8410e626569 ("irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and IRQCHIP_MATCH helper macros") Signed-off-by: Miaoqian Lin Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20230102121318.3990586-1-linmq006@gmail.com --- drivers/irqchip/irqchip.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c index 3570f0a..7899607 100644 --- a/drivers/irqchip/irqchip.c +++ b/drivers/irqchip/irqchip.c @@ -38,8 +38,10 @@ int platform_irqchip_probe(struct platform_device *pdev) struct device_node *par_np = of_irq_find_parent(np); of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev); - if (!irq_init_cb) + if (!irq_init_cb) { + of_node_put(par_np); return -EINVAL; + } if (par_np == np) par_np = NULL; @@ -52,8 +54,10 @@ int platform_irqchip_probe(struct platform_device *pdev) * interrupt controller. The actual initialization callback of this * interrupt controller can check for specific domains as necessary. */ - if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) + if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) { + of_node_put(par_np); return -EPROBE_DEFER; + } return irq_init_cb(np, par_np); }