]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust_binder: fix oneway spam detection
authorCarlos Llamas <cmllamas@google.com>
Tue, 10 Feb 2026 23:28:20 +0000 (23:28 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Feb 2026 05:31:50 +0000 (21:31 -0800)
commit4fc87c240b8f30e22b7ebaae29d57105589e1c0b
treecbb781d268f264ee6931c2400a4037ec80221978
parent994d5dfa4e670087ef92cfc60ee57102ffc8ef38
rust_binder: fix oneway spam detection

The spam detection logic in TreeRange was executed before the current
request was inserted into the tree. So the new request was not being
factored in the spam calculation. Fix this by moving the logic after
the new range has been inserted.

Also, the detection logic for ArrayRange was missing altogether which
meant large spamming transactions could get away without being detected.
Fix this by implementing an equivalent low_oneway_space() in ArrayRange.

Note that I looked into centralizing this logic in RangeAllocator but
iterating through 'state' and 'size' got a bit too complicated (for me)
and I abandoned this effort.

Cc: stable <stable@kernel.org>
Cc: Alice Ryhl <aliceryhl@google.com>
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260210232949.3770644-1-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder/range_alloc/array.rs
drivers/android/binder/range_alloc/mod.rs
drivers/android/binder/range_alloc/tree.rs