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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 430B6C63797 for ; Sun, 5 Feb 2023 11:30:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229643AbjBELaJ (ORCPT ); Sun, 5 Feb 2023 06:30:09 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); }