public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@kernel.org>
To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: Jens Wiklander <jens.wiklander@linaro.org>,
	 Sudeep Holla <sudeep.holla@kernel.org>
Subject: [PATCH 6/8] firmware: arm_ffa: Unregister v1.0 bus notifier on teardown
Date: Thu, 23 Apr 2026 18:22:56 +0100	[thread overview]
Message-ID: <20260423-ffa_fixes-v1-6-61189661affe@kernel.org> (raw)
In-Reply-To: <20260423-ffa_fixes-v1-0-61189661affe@kernel.org>

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")
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
---
 drivers/firmware/arm_ffa/driver.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 0e030f377985..4edb88079bac 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -100,6 +100,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;
@@ -1638,6 +1639,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;
@@ -1721,6 +1731,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();
 
@@ -1748,11 +1760,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;
 	}
 

-- 
2.43.0



  parent reply	other threads:[~2026-04-23 17:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 17:22 [PATCH 0/8] firmware: arm_ffa: Fix cleanup, notification, and discovery paths Sudeep Holla
2026-04-23 17:22 ` [PATCH 1/8] firmware: arm_ffa: Check for NULL FF-A ID table while driver registration Sudeep Holla
2026-04-23 17:22 ` [PATCH 2/8] firmware: arm_ffa: Skip free_pages on RX buffer alloc failure Sudeep Holla
2026-04-23 17:22 ` [PATCH 3/8] firmware: arm_ffa: Align RxTx buffer size before mapping Sudeep Holla
2026-04-23 17:22 ` [PATCH 4/8] firmware: arm_ffa: Fix Rx buffer release in fwk notification handler Sudeep Holla
2026-04-23 17:22 ` [PATCH 5/8] firmware: arm_ffa: Validate framework notification payload bounds Sudeep Holla
2026-04-23 17:22 ` Sudeep Holla [this message]
2026-04-23 17:22 ` [PATCH 7/8] firmware: arm_ffa: Fix sched-recv callback partition lookup Sudeep Holla
2026-04-23 17:22 ` [PATCH 8/8] firmware: arm_ffa: Bound PARTITION_INFO_GET_REGS copies Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260423-ffa_fixes-v1-6-61189661affe@kernel.org \
    --to=sudeep.holla@kernel.org \
    --cc=jens.wiklander@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox