Skip to contentSkip to conversation

FAILED: patch "[PATCH] interconnect: fix icc_provider_del() error handling" failed to apply to 5.10-stable tree

PATCH [email protected] 1 participant 1 message Mar 20, 2023

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x e0e7089bf9a87bc5e3997422e4e24563424f9018
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' HEAD^..

Possible dependencies:

e0e7089bf9a8 ("interconnect: fix icc_provider_del() error handling") 680f8666baf6 ("interconnect: Make icc_provider_del() return void")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From e0e7089bf9a87bc5e3997422e4e24563424f9018 Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Mon, 6 Mar 2023 08:56:30 +0100
Subject: [PATCH] interconnect: fix icc_provider_del() error handling

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 [email protected] # 5.1: 680f8666baf6: interconnect: Make icc_provider_del() return void
drivers/interconnect/core.c +2 -12
index 5217f449eeec..cabb6f5df83e 100644
@@ -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);