Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2933388iog; Mon, 20 Jun 2022 07:46:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1soOfiBRJS3SrtW+jCqhns7tyWZwHyegLsW+eaQ+1fh4j70tx8M2sIt4OUxUgnbI6k6sQbE X-Received: by 2002:a17:902:e30c:b0:16a:2ee:c232 with SMTP id q12-20020a170902e30c00b0016a02eec232mr18883243plc.123.1655736408849; Mon, 20 Jun 2022 07:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655736408; cv=none; d=google.com; s=arc-20160816; b=vuA+nbn5YcHrw3Y1fxdxFjIUxppRdmB8aq9YMvrsEvf2EXd3AhIwTKfh0eaK5enFMM GgLn9dlbRHwd6PMxudmcVYPQmFoSJoMa6yKW4mVchvdxVFJoD/MEk+RJHXfMCIhUhXm7 VrA+AXDfrhLzjMTx7tTaPzM6bBbsOXKwze14/ZQ9GcahbwuQoYnF+N4LBQ/I4u9PIc8D Zp7laiPCCL5otlbn6EOCtbnl6RXt/CCi5/FhQWlKl3xar2wyl+y7B5vJlzzPNnGtDHYC lt+G+gdDSfZf/iJ7iqpQ4RrHBzb/lh+INlstMWQl2a7by9CP1SJQO6FUIdoO0D5dCDNO xQuQ== 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=2ODWlrZ6kBpcJPyjpWT4EXf++OQRTpIvQmoau107e1o=; b=e31jLs0hUBGTHYBKDb37IPc8VYwtkLrXMpp2aUYMZ0+WSjyDhOKuB0ssxfDDw3pq/o tJKgidOl5Q3U4myPfuIagO0GylK33PMBaoED13o4e6dnMf/GMgxZJYvOBY9KaZF2UfVJ NL54+T/24/r3i2jffdNJz+Yq/raNqHE/hZoHLWzCx8IJfv4TW/GGaW3Pj3f73QBpBwU3 3xnTWxsrj1VZEYPF9Zia6uupIFeLLKCvAovsq3UGCciRW0bmDtR7Mr658hco02RSMYdJ 8xyv8JmidBSQQDD68uuw0fHV6CNXoRw9yaNuI+5BV/+5z65+QoqsFovYE4tmmn9SJhtp rtQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mk9TvBBz; 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 p9-20020a170902bd0900b0016763e0a6eesi8740241pls.486.2022.06.20.07.46.35; Mon, 20 Jun 2022 07:46:48 -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=Mk9TvBBz; 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 S243911AbiFTNEX (ORCPT + 99 others); Mon, 20 Jun 2022 09:04:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243877AbiFTNCN (ORCPT ); Mon, 20 Jun 2022 09:02:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E44EB18343; Mon, 20 Jun 2022 05:57:33 -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 0FB4E614EB; Mon, 20 Jun 2022 12:57:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 149D5C3411B; Mon, 20 Jun 2022 12:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729852; bh=HR7GqMWbL932M9kWU/TdhBn86PFa6YN1adQ5FdOgz6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mk9TvBBzPCRuwVSLkvohPobZ5ksiZjXF36wS1EYp4a8/eD6Mu3P2k6uXouqRgoiUr H6BeEwokncE0Cn4sshNcYM6iU6ZegRf+dJwAFyk8BzhGrN+RpKatUV2ujNXwOj5tQe uoYY05nSBEwLxrLPf+2/HH7ixTEF7+PVxpmDtRE8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 096/141] irqchip/realtek-rtl: Fix refcount leak in map_interrupts Date: Mon, 20 Jun 2022 14:50:34 +0200 Message-Id: <20220620124732.382809166@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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 eff4780f83d0ae3e5b6c02ff5d999dc4c1c5c8ce ] of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. This function doesn't call of_node_put() in error path. Call of_node_put() directly after of_property_read_u32() to cover both normal path and error path. Fixes: 9f3a0f34b84a ("irqchip: Add support for Realtek RTL838x/RTL839x interrupt controller") Signed-off-by: Miaoqian Lin Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220601080930.31005-7-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/irqchip/irq-realtek-rtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-realtek-rtl.c b/drivers/irqchip/irq-realtek-rtl.c index 50a56820c99b..56bf502d9c67 100644 --- a/drivers/irqchip/irq-realtek-rtl.c +++ b/drivers/irqchip/irq-realtek-rtl.c @@ -134,9 +134,9 @@ static int __init map_interrupts(struct device_node *node, struct irq_domain *do if (!cpu_ictl) return -EINVAL; ret = of_property_read_u32(cpu_ictl, "#interrupt-cells", &tmp); + of_node_put(cpu_ictl); if (ret || tmp != 1) return -EINVAL; - of_node_put(cpu_ictl); cpu_int = be32_to_cpup(imap + 2); if (cpu_int > 7 || cpu_int < 2) -- 2.35.1