From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DFDE1863 for ; Wed, 28 Dec 2022 15:40:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B97AC433EF; Wed, 28 Dec 2022 15:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1672242023; bh=lay2NtNrmRw2kZWDmZ2ZRMpRUVc1q6hf+jpHMRQQtmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0UVGMmhoyUm3QWNWZzTJsAh0S4DaPKbqeqJUD1c9x748A96FRR1ZafKEM+/1Prhe vyiQOzSWxAmDWRkp8ZLZiEHe4fLz9s4CyQE1WfLa3jxm208mvs2mMlqO7bvmOSoy1I DQrkakfs0Qe/JO5gBD7LdpcstPlythqyHMeI2UUY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Miaoqian Lin , Andrew Donnellan , Frederic Barrat , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 554/731] cxl: Fix refcount leak in cxl_calc_capp_routing Date: Wed, 28 Dec 2022 15:41:01 +0100 Message-Id: <20221228144312.597136454@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221228144256.536395940@linuxfoundation.org> References: <20221228144256.536395940@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Miaoqian Lin [ Upstream commit 1d09697ff22908ae487fc8c4fbde1811732be523 ] of_get_next_parent() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. This function only calls of_node_put() in normal path, missing it in the error path. Add missing of_node_put() to avoid refcount leak. Fixes: f24be42aab37 ("cxl: Add psl9 specific code") Signed-off-by: Miaoqian Lin Acked-by: Andrew Donnellan Acked-by: Frederic Barrat Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220605060038.62217-1-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/misc/cxl/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c index 0ac3f4cb88ac..d183836d80e3 100644 --- a/drivers/misc/cxl/pci.c +++ b/drivers/misc/cxl/pci.c @@ -387,6 +387,7 @@ int cxl_calc_capp_routing(struct pci_dev *dev, u64 *chipid, rc = get_phb_index(np, phb_index); if (rc) { pr_err("cxl: invalid phb index\n"); + of_node_put(np); return rc; } -- 2.35.1