Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2207574iof; Tue, 7 Jun 2022 23:13:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNDBEX9Enpc9lQFBRzH0yugCiaYaQw/QMPH0AMxrodfn3M3Nb00j8GZYb5N5mENKuJY+3Q X-Received: by 2002:a17:90a:f2ce:b0:1e8:3e55:bbfa with SMTP id gt14-20020a17090af2ce00b001e83e55bbfamr26781497pjb.204.1654668810830; Tue, 07 Jun 2022 23:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668810; cv=none; d=google.com; s=arc-20160816; b=Y8bL7VCzMDpB/5Abxsilm+pePYiauMZlq3bx3n4oPRyqUhHAAV6uw24WQH2md38vde UdrUFRQpSLh5Fel2bcDceR5YbAXUg4/vBqUo6bGUe2LNQ9caMcp5n6SwnhM/M46GCXe0 hjPYMscXtotyM2puNA6zas7p7nFK2/C+krXnHBM5yo8in3xAIBFdIO8Yuw7zGRfA4hUm nJEb/0MkWQdEdldk5GAYY/kxnfcU+0zA/GCP7dswMzx5X0Lqdbngu29qRD4ktKvSTCpV e+htOpzBE+OmNitDQsi1Pr3bo0eMQsHAIOh6Z91pfpo3d+CzBdVUibxZiHJKaf28K3yz 0hjA== 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=X8D3OUEcSuAsIfG5Wht/TCyIymkXz7ofwEyI4RPHKZ0=; b=ZSlzJscUva/uoW7nf5xJWYyjTNVeUfqt6SfOQc3//19wgKtp5tVZ8SryliYN0Dy0GM tDq/AZpRDMm97D9Q/Mvm28ffgyUgOB3g7mLG8XL1Lsb/fR7RtMG682UhnUGweSqqpxI8 mk2esP8mqovs/3U4NZXIn9KGFUJ1ppO06YkoxlekDfrnrBNCTqWr43ZTEtyHi78QTvzs CFUGEDTQ2BOCV+3IfNbR4s8o+Gk3w9NFoFjamqLg1XMLq0ApTC7YyZUdGDaXvXOQHuGj ffAW2Fm43WfmLDyQcHLHMJ6dQVWgSnvz4ydP4T5+3Lb+kOHQcq5A2h27WgKVSNr5gpHv ydyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XbeaXkKF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id be7-20020a170902aa0700b001678ce9091bsi6404957plb.554.2022.06.07.23.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:13:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XbeaXkKF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2DFE73CE24A; Tue, 7 Jun 2022 22:36:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390434AbiFHBud (ORCPT + 99 others); Tue, 7 Jun 2022 21:50:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382708AbiFGWCs (ORCPT ); Tue, 7 Jun 2022 18:02:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D5991957A4; Tue, 7 Jun 2022 12:15:06 -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 4240F61846; Tue, 7 Jun 2022 19:15:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FEA0C385A5; Tue, 7 Jun 2022 19:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629304; bh=RiYoesI/2/VhLz4xXzKPGtNRHm3pm6lxNILgLYxpFek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XbeaXkKFGT2CZLiPm96FDGObiccqr8xFv25KFt0AwfV8elRDaZbwjOvV6BmnVmJO9 qomDuXFYyn2wZEwUfIkJVwH/pytcmveA4JTVNj9OiuSKtrdEYuiHd+v6fRcqXSlfB6 2/AaC5wYX8xBrGaVUvB0mFg2WoQfyNHRMMo3fLGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 644/879] powerpc/xive: Fix refcount leak in xive_spapr_init Date: Tue, 7 Jun 2022 19:02:42 +0200 Message-Id: <20220607165021.539731054@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 1d1fb9618bdd5a5fbf9a9eb75133da301d33721c ] of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: eac1e731b59e ("powerpc/xive: guest exploitation of the XIVE interrupt controller") Signed-off-by: Miaoqian Lin Reviewed-by: Cédric Le Goater Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220512090535.33397-1-linmq006@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/sysdev/xive/spapr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/spapr.c index 29456c255f9f..503f544d28e2 100644 --- a/arch/powerpc/sysdev/xive/spapr.c +++ b/arch/powerpc/sysdev/xive/spapr.c @@ -830,12 +830,12 @@ bool __init xive_spapr_init(void) /* Resource 1 is the OS ring TIMA */ if (of_address_to_resource(np, 1, &r)) { pr_err("Failed to get thread mgmnt area resource\n"); - return false; + goto err_put; } tima = ioremap(r.start, resource_size(&r)); if (!tima) { pr_err("Failed to map thread mgmnt area\n"); - return false; + goto err_put; } if (!xive_get_max_prio(&max_prio)) @@ -871,6 +871,7 @@ bool __init xive_spapr_init(void) if (!xive_core_init(np, &xive_spapr_ops, tima, TM_QW1_OS, max_prio)) goto err_mem_free; + of_node_put(np); pr_info("Using %dkB queues\n", 1 << (xive_queue_shift - 10)); return true; @@ -878,6 +879,8 @@ bool __init xive_spapr_init(void) xive_irq_bitmap_remove_all(); err_unmap: iounmap(tima); +err_put: + of_node_put(np); return false; } -- 2.35.1