[PATCH v4 3/6] rust_binder: schedule NodeDeath outside of node_refs lock
From: Alice Ryhl
Date: Tue Jul 07 2026 - 06:37:54 EST
There's no reason to hold the node_refs lock while scheduling the
NodeDeath to the thread todo list, so don't. The call to set_cleared()
is kept under the lock so that the state update is kept atomic.
Reviewed-by: Matthew Maurer <mmaurer@xxxxxxxxxx>
Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
---
drivers/android/binder/process.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs
index da84c0072d46..505e0bc52748 100644
--- a/drivers/android/binder/process.rs
+++ b/drivers/android/binder/process.rs
@@ -1303,7 +1303,10 @@ pub(crate) fn clear_death(&self, reader: &mut UserSliceReader, thread: &Thread)
// Update state and determine if we need to queue a work item. We only need to do it when
// the node is not dead or if the user already completed the death notification.
- if death.set_cleared(false) {
+ let should_schedule = death.set_cleared(false);
+ drop(refs);
+
+ if should_schedule {
if let Some(death) = ListArc::try_from_arc_or_drop(death) {
let _ = thread.push_work_if_looper(death);
}
--
2.55.0.rc2.803.g1fd1e6609c-goog