[PATCH] rust_binder: report EINVAL for unknown handles

From: Alice Ryhl

Date: Wed Nov 18 2026 - 06:25:49 EST


Currently unknown handles are reported as ENOENT, which userspace
doesn't treat as a fatal error. However, providing the wrong handle is a
fatal API violation, and indicates UAF in the userspace process.

Thus, change it to EINVAL to match C Binder and make userspace treat it
as a fatal error.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
---
drivers/android/binder/process.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs
index e97213250beb..406d80cfff08 100644
--- a/drivers/android/binder/process.rs
+++ b/drivers/android/binder/process.rs
@@ -958,7 +958,7 @@ pub(crate) fn get_node_from_handle(&self, handle: u32, strong: bool) -> Result<N
.lock()
.by_handle
.get_mut(&handle)
- .ok_or(ENOENT)?
+ .ok_or(EINVAL)?
.node_ref()
.clone(strong)
}

---
base-commit: 917fcbf033154a6c8d83cfa6c88f012b71eb37b2
change-id: 20261029-binder-unknown-einval-10407d1ebb1e

Best regards,
--
Alice Ryhl <aliceryhl@xxxxxxxxxx>