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 <aliceryhl@google.com>
This commit is contained in:
Alice Ryhl
2025-06-25 09:55:06 +00:00
committed by Matthew Maurer
parent d47caa0b28
commit cd7cc3a247

View File

@@ -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);
}