]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
firmware: arm_ffa: Unregister bus notifier on teardown for FF-A v1.0
authorSudeep Holla <sudeep.holla@kernel.org>
Tue, 28 Apr 2026 18:33:29 +0000 (19:33 +0100)
committerSudeep Holla <sudeep.holla@kernel.org>
Wed, 29 Apr 2026 15:50:34 +0000 (16:50 +0100)
For FF-A v1.0 the driver registers a bus notifier to backfill UUID
matching, but the notifier was never unregistered on cleanup paths.
Track the registration state and unregister it during teardown and early
partition-setup failure.

Fixes: 9dd15934f60d ("firmware: arm_ffa: Move the FF-A v1.0 NULL UUID workaround to bus notifier")
Link: https://patch.msgid.link/20260428-ffa_fixes-v2-5-8595ae450034@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
drivers/firmware/arm_ffa/driver.c

index 2241e851f7ae789207520c7415ccc6a700587812..a122814eb6d75edff3bb68dd1209598b4057dfd9 100644 (file)
@@ -101,6 +101,7 @@ struct ffa_drv_info {
        bool mem_ops_native;
        bool msg_direct_req2_supp;
        bool bitmap_created;
+       bool bus_notifier_registered;
        bool notif_enabled;
        unsigned int sched_recv_irq;
        unsigned int notif_pend_irq;
@@ -1630,6 +1631,15 @@ static struct notifier_block ffa_bus_nb = {
        .notifier_call = ffa_bus_notifier,
 };
 
+static void ffa_bus_notifier_unregister(void)
+{
+       if (!drv_info->bus_notifier_registered)
+               return;
+
+       bus_unregister_notifier(&ffa_bus_type, &ffa_bus_nb);
+       drv_info->bus_notifier_registered = false;
+}
+
 static int ffa_xa_add_partition_info(struct ffa_device *dev)
 {
        struct ffa_dev_part_info *info;
@@ -1713,6 +1723,8 @@ static void ffa_partitions_cleanup(void)
        struct list_head *phead;
        unsigned long idx;
 
+       ffa_bus_notifier_unregister();
+
        /* Clean up/free all registered devices */
        ffa_devices_unregister();
 
@@ -1740,11 +1752,14 @@ static int ffa_setup_partitions(void)
                ret = bus_register_notifier(&ffa_bus_type, &ffa_bus_nb);
                if (ret)
                        pr_err("Failed to register FF-A bus notifiers\n");
+               else
+                       drv_info->bus_notifier_registered = true;
        }
 
        count = ffa_partition_probe(&uuid_null, &pbuf);
        if (count <= 0) {
                pr_info("%s: No partitions found, error %d\n", __func__, count);
+               ffa_bus_notifier_unregister();
                return -EINVAL;
        }