This is a note to let you know that I've just added the patch titled interconnect: qcom: osm-l3: fix registration race to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: interconnect-qcom-osm-l3-fix-registration-race.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 174941ed28a3573db075da46d95b4dcf9d4c49c2 Mon Sep 17 00:00:00 2001 From: Johan Hovold <johan+linaro@xxxxxxxxxx> Date: Mon, 6 Mar 2023 08:56:33 +0100 Subject: interconnect: qcom: osm-l3: fix registration race From: Johan Hovold <johan+linaro@xxxxxxxxxx> commit 174941ed28a3573db075da46d95b4dcf9d4c49c2 upstream. The current interconnect provider registration interface is inherently racy as nodes are not added until the after adding the provider. This can specifically cause racing DT lookups to fail: of_icc_xlate_onecell: invalid index 0 cpu cpu0: error -EINVAL: error finding src node cpu cpu0: dev_pm_opp_of_find_icc_paths: Unable to get path0: -22 qcom-cpufreq-hw: probe of 18591000.cpufreq failed with error -22 Switch to using the new API where the provider is not registered until after it has been fully initialised. Fixes: 5bc9900addaf ("interconnect: qcom: Add OSM L3 interconnect provider support") Cc: stable@xxxxxxxxxxxxxxx # 5.7 Reviewed-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx> Signed-off-by: Johan Hovold <johan+linaro@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230306075651.2449-6-johan+linaro@xxxxxxxxxx Signed-off-by: Georgi Djakov <djakov@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/interconnect/qcom/osm-l3.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) --- a/drivers/interconnect/qcom/osm-l3.c +++ b/drivers/interconnect/qcom/osm-l3.c @@ -216,8 +216,8 @@ static int qcom_osm_l3_remove(struct pla { struct qcom_osm_l3_icc_provider *qp = platform_get_drvdata(pdev); + icc_provider_deregister(&qp->provider); icc_nodes_remove(&qp->provider); - icc_provider_del(&qp->provider); return 0; } @@ -303,14 +303,9 @@ static int qcom_osm_l3_probe(struct plat provider->set = qcom_osm_l3_set; provider->aggregate = icc_std_aggregate; provider->xlate = of_icc_xlate_onecell; - INIT_LIST_HEAD(&provider->nodes); provider->data = data; - ret = icc_provider_add(provider); - if (ret) { - dev_err(&pdev->dev, "error adding interconnect provider\n"); - return ret; - } + icc_provider_init(provider); for (i = 0; i < num_nodes; i++) { size_t j; @@ -333,12 +328,15 @@ static int qcom_osm_l3_probe(struct plat } data->num_nodes = num_nodes; + ret = icc_provider_register(provider); + if (ret) + goto err; + platform_set_drvdata(pdev, qp); return 0; err: icc_nodes_remove(provider); - icc_provider_del(provider); return ret; } Patches currently in stable-queue which might be from johan+linaro@xxxxxxxxxx are queue-6.1/memory-tegra20-emc-fix-interconnect-registration-race.patch queue-6.1/memory-tegra124-emc-fix-interconnect-registration-race.patch queue-6.1/serial-qcom-geni-fix-console-shutdown-hang.patch queue-6.1/interconnect-exynos-fix-registration-race.patch queue-6.1/interconnect-imx-fix-registration-race.patch queue-6.1/memory-tegra30-emc-fix-interconnect-registration-race.patch queue-6.1/interconnect-qcom-msm8974-fix-registration-race.patch queue-6.1/memory-tegra-fix-interconnect-registration-race.patch queue-6.1/interconnect-qcom-rpm-fix-probe-child-node-error-handling.patch queue-6.1/interconnect-qcom-rpm-fix-registration-race.patch queue-6.1/interconnect-fix-provider-registration-api.patch queue-6.1/interconnect-fix-icc_provider_del-error-handling.patch queue-6.1/interconnect-qcom-rpmh-fix-registration-race.patch queue-6.1/interconnect-fix-mem-leak-when-freeing-nodes.patch queue-6.1/interconnect-qcom-rpmh-fix-probe-child-node-error-handling.patch queue-6.1/interconnect-exynos-fix-node-leak-in-probe-pm-qos-error-path.patch queue-6.1/interconnect-qcom-osm-l3-fix-registration-race.patch