From cd7cc3a247ec00e8018c8907b9ba8585c78089d1 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Wed, 25 Jun 2025 09:55:06 +0000 Subject: [PATCH] ANDROID: rust_binder: do not take refcount during GET_NODE_INFO_FOR_REF The ioctl GET_NODE_INFO_FOR_REF will query the refcount of a remote node, which servicemanager uses to determine whether a lazy service should be shut down. To return the right counts, the ioctl itself should not take a refcount on the node. Bug: 427655909 Change-Id: I79a5e9f9506e6437900c8188de950ee449f8ec89 Signed-off-by: Alice Ryhl --- drivers/android/binder/process.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs index 5f64c59bc3fe..8ae013580494 100644 --- a/drivers/android/binder/process.rs +++ b/drivers/android/binder/process.rs @@ -1141,11 +1141,10 @@ impl Process { return Err(EPERM); } - let node_ref = self - .get_node_from_handle(out.handle, true) - .or(Err(EINVAL))?; - // Get the counts from the node. { + let mut node_refs = self.node_refs.lock(); + let node_info = node_refs.by_handle.get_mut(&out.handle).ok_or(ENOENT)?; + let node_ref = node_info.node_ref(); let owner_inner = node_ref.node.owner.inner.lock(); node_ref.node.populate_counts(&mut out, &owner_inner); }