]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust_binder: avoid calling pending_oneway_finished() on TF_UPDATE_TXN
authorAlice Ryhl <aliceryhl@google.com>
Tue, 14 Apr 2026 12:02:34 +0000 (12:02 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 May 2026 09:55:33 +0000 (11:55 +0200)
commit4c19719eb8b8df08c5bec7c499f73ddaea6f09fc
treefdf3e7b26c9f770bef175e598c3a6c81bf719a8b
parent542f5248cb481073203e0dadab5bcbd28aeae308
rust_binder: avoid calling pending_oneway_finished() on TF_UPDATE_TXN

When an outdated transaction is removed from `oneway_todo` due to
`TF_UPDATE_TXN`, its `Allocation` is dropped. The current implementation
of `Allocation::drop` calls `pending_oneway_finished()`, assuming the
transaction was executed. This leads to premature execution of the next
queued one-way transaction.

Fix this by taking the `oneway_node` from the `Allocation` of the
outdated transaction before it is dropped. This prevents
`Allocation::drop` from signaling completion.

We do not call `take_oneway_node()` from `Transaction::cancel` because
it's actually correct to call `pending_oneway_finished()` on cancel if
the transaction did not come from `oneway_todo`. This ensures that if
`BINDER_THREAD_EXIT` is invoked and cancels a oneway transaction, then
the next transaction is taken from `oneway_todo`.

This bug does not lead to any issues in the kernel, but may lead to
Binder delivering transactions to userspace earlier than userspace
expected to receive them.

Cc: stable <stable@kernel.org>
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Assisted-by: Antigravity:gemini
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Carlos Llamas <cmllamas@google.com>
Link: https://patch.msgid.link/20260414-tf-update-txn-fix-v1-1-d2b83303acc9@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder/allocation.rs
drivers/android/binder/transaction.rs