mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] firmware: qcom: tzmem: use sleepable variant of DO_ONCE()
@ 2026-09-05  3:04 Daniel J Blueman
  0 siblings, 0 replies; only message in thread
From: Daniel J Blueman @ 2026-09-05  3:04 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Bartosz Golaszewski, Konrad Dybcio, Mukesh Ojha, linux-arm-msm,
	linux-kernel, Daniel J Blueman

qcom_tzmem_enable() runs qcom_tzmem_init() using DO_ONCE(), taking
the once_lock spinlock. qcom_tzmem_init() subsequently takes the
qcom_scm_lock mutex, potentially sleeping holding the spinlock,
triggering:

  BUG: sleeping function called from invalid context at drivers/firmware/qcom/qcom_scm.c:334
  in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 112, name: kworker/u49:4
  Call trace:
   __might_resched+0x378/0x698
   __might_sleep+0x9c/0x220
   qcom_scm_call+0x3c/0xf0
   __qcom_scm_is_call_available+0xec/0x198
   qcom_scm_shm_bridge_enable+0xc4/0x158
   qcom_tzmem_enable+0x178/0x218
   qcom_scm_probe+0x4d4/0xcb8

Fix this by using DO_ONCE_SLEEPABLE().

Fixes: 9941fe8a04f3 ("firmware: qcom: scm: Fix tzmem state on probe retry")
Signed-off-by: Daniel J Blueman <daniel@quora.org>
---
 drivers/firmware/qcom/qcom_tzmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/qcom/qcom_tzmem.c b/drivers/firmware/qcom/qcom_tzmem.c
index 0fd9581275f1..ebcdee3c5975 100644
--- a/drivers/firmware/qcom/qcom_tzmem.c
+++ b/drivers/firmware/qcom/qcom_tzmem.c
@@ -518,7 +518,7 @@ int qcom_tzmem_enable(struct device *dev)
 	static int result;
 
 	qcom_tzmem_dev = dev;
-	DO_ONCE(qcom_tzmem_do_init, &result);
+	DO_ONCE_SLEEPABLE(qcom_tzmem_do_init, &result);
 	return result;
 }
 EXPORT_SYMBOL_GPL(qcom_tzmem_enable);
-- 
2.53.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-05  3:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-05  3:04 [PATCH] firmware: qcom: tzmem: use sleepable variant of DO_ONCE() Daniel J Blueman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®