Skip to content

Commit 03e071a

Browse files
committed
rust_binder: keep NodeDeath in NodeRefInfo during process cleanup
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@google.com> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
1 parent 0eed9cf commit 03e071a

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

drivers/android/binder/process.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,13 +1389,11 @@ impl Process {
13891389
// SAFETY: We are removing the `NodeRefInfo` from the right node.
13901390
unsafe { info.node_ref2().node.remove_node_info(info) };
13911391

1392-
// Remove all death notifications from the nodes (that belong to a different process).
1393-
let death = if let Some(existing) = info.death().take() {
1394-
existing
1395-
} else {
1396-
continue;
1397-
};
1398-
death.set_cleared(false);
1392+
// Clear death notifications from the nodes (that belong to a different process).
1393+
// No need to remove them from `info` as we clear info below.
1394+
if let Some(death) = info.death().as_ref() {
1395+
death.set_cleared(false);
1396+
}
13991397
}
14001398

14011399
// Clean up freeze listeners.

0 commit comments

Comments
 (0)