From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC488C61DA4 for ; Mon, 6 Mar 2023 08:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Lsph4/P6J/Q73jLiIjwzzlAs4IU1EjyCZJ6sbvVqlbo=; b=I7OygjA6PZS1Hd eIUqnaGEVO3PZtUz3S6QELGugeDmGJVXnHZX6C8Lj7YwiGvsVnQC9X4RMHnzHbhzewl1mYaRnH9VF HbVVUk1k9UjYbPSVRElkHBRk8vJWY03xFJJmCyUFebhx8rvcaFUksn+g86PtIv352yMLD8DmHfguh 2WAyt+v2xBvwpzjYvewChusW34HGD8IdkfdlW2LPtNJNn42tplpN3gHnS+C5NaEg0789iGfqc33aV JKVxL70Vk7oUF3qrzuBemZsNR1p9RdVqU6+dei3xmhz+sd3zpVRy6CU/mvggpEswrurHoLNITVdW/ DIPw2f12LJVFx6XEFHng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZ5kq-00BiTL-ND; Mon, 06 Mar 2023 07:59:32 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZ5j1-00BhYM-4Q for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 07:57:43 +0000 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 ams.source.kernel.org (Postfix) with ESMTPS id A9F6DB80CAB; Mon, 6 Mar 2023 07:57:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45DE2C4339B; Mon, 6 Mar 2023 07:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678089456; bh=Gq0h6KWRJ7+7NQjJFlZM0IIfLOQXyWOu463epBupeVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WRVn3Mena1i634HIHPWixQ/g1cfQETDXfXhBJGyPbNQ2zD0uRLBLLdX6lmKQBQRkf 0w0PC3EPFc1n7Gfqg6Tt+p005RchBMtNChwFTj+ZAyCoAaZFy0unjM0ozuy9HwFIEQ fJVXcORUbnHtC6JYGafTiUcBCtJcj1Y/rWtvG2qcpuHixgnRcis+MncYc4/RdtuflY KO10M3uLJUpywRlZZvIU9pN9ZeLKNPZS2uvrDkTRjP4AANF8rQhZz8j0DI5j94hyHv ScxbeNuAwSau22/oKtyISv9Joc28MZrW40YPJFc4Wsy5LjMYjfI4QcZSx7r1lrD13c 1Y//i9567+Kng== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ5jb-0000hv-Rs; Mon, 06 Mar 2023 08:58:15 +0100 From: Johan Hovold To: Georgi Djakov Cc: "Shawn Guo" , "Sascha Hauer" , "Pengutronix Kernel Team" , "Fabio Estevam" , "NXP Linux Team" , "Andy Gross" , "Bjorn Andersson" , "Konrad Dybcio" , "Sylwester Nawrocki" , =?UTF-8?q?Artur=20=C5=9Awigo=C5=84?= , "Krzysztof Kozlowski" , "Alim Akhtar" , "Thierry Reding" , "Jonathan Hunter" , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH v2 02/23] interconnect: fix icc_provider_del() error handling Date: Mon, 6 Mar 2023 08:56:30 +0100 Message-Id: <20230306075651.2449-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230306075651.2449-1-johan+linaro@kernel.org> References: <20230306075651.2449-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230305_235739_542187_37AEF731 X-CRM114-Status: GOOD ( 13.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The interconnect framework currently expects that providers are only removed when there are no users and after all nodes have been removed. There is currently nothing that guarantees this to be the case and the framework does not do any reference counting, but refusing to remove the provider is never correct as that would leave a dangling pointer to a resource that is about to be released in the global provider list (e.g. accessible through debugfs). Replace the current sanity checks with WARN_ON() so that the provider is always removed. Fixes: 11f1ceca7031 ("interconnect: Add generic on-chip interconnect API") Cc: stable@vger.kernel.org # 5.1: 680f8666baf6: interconnect: Make icc_provider_del() return void Reviewed-by: Konrad Dybcio Signed-off-by: Johan Hovold --- drivers/interconnect/core.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 5217f449eeec..cabb6f5df83e 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -1065,18 +1065,8 @@ EXPORT_SYMBOL_GPL(icc_provider_add); void icc_provider_del(struct icc_provider *provider) { mutex_lock(&icc_lock); - if (provider->users) { - pr_warn("interconnect provider still has %d users\n", - provider->users); - mutex_unlock(&icc_lock); - return; - } - - if (!list_empty(&provider->nodes)) { - pr_warn("interconnect provider still has nodes\n"); - mutex_unlock(&icc_lock); - return; - } + WARN_ON(provider->users); + WARN_ON(!list_empty(&provider->nodes)); list_del(&provider->provider_list); mutex_unlock(&icc_lock); -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel