[PATCH v4 4/6] rust_binder: keep NodeDeath in NodeRefInfo during process cleanup
From: Alice Ryhl
Date: Tue Jul 07 2026 - 06:42:28 EST
By keeping the NodeDeath inside the NodeRefInfo structure during process
cleanup, we avoid running its destructor under the node_refs lock. It is
still dropped shortly thereafter when the entire rbtree holding the
NodeRefInfo objects is dropped, but that occurs outside of the lock.
Reviewed-by: Matthew Maurer <mmaurer@xxxxxxxxxx>
Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
---
drivers/android/binder/process.rs | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs
index 505e0bc52748..410218505417 100644
--- a/drivers/android/binder/process.rs
+++ b/drivers/android/binder/process.rs
@@ -1389,13 +1389,11 @@ fn deferred_release(self: Arc<Self>) {
// SAFETY: We are removing the `NodeRefInfo` from the right node.
unsafe { info.node_ref2().node.remove_node_info(info) };
- // Remove all death notifications from the nodes (that belong to a different process).
- let death = if let Some(existing) = info.death().take() {
- existing
- } else {
- continue;
- };
- death.set_cleared(false);
+ // Clear death notifications from the nodes (that belong to a different process).
+ // No need to remove them from `info` as we clear info below.
+ if let Some(death) = info.death().as_ref() {
+ death.set_cleared(false);
+ }
}
// Clean up freeze listeners.
--
2.55.0.rc2.803.g1fd1e6609c-goog