binder: don't detect sender/target during buffer cleanup
authorTodd Kjos <tkjos@google.com>
Fri, 15 Oct 2021 23:38:11 +0000 (16:38 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Oct 2021 07:38:55 +0000 (09:38 +0200)
commit32e9f56a96d8d0f23cb2aeb2a3cd18d40393e787
tree7ecf423798fab72043ffa53c39b9183f82f9d1c2
parentbe24dd486d45a1846866615bd4ec5f5192ea5de4
binder: don't detect sender/target during buffer cleanup

When freeing txn buffers, binder_transaction_buffer_release()
attempts to detect whether the current context is the target by
comparing current->group_leader to proc->tsk. This is an unreliable
test. Instead explicitly pass an 'is_failure' boolean.

Detecting the sender was being used as a way to tell if the
transaction failed to be sent.  When cleaning up after
failing to send a transaction, there is no need to close
the fds associated with a BINDER_TYPE_FDA object. Now
'is_failure' can be used to accurately detect this case.

Fixes: 44d8047f1d87 ("binder: use standard functions to allocate fds")
Cc: stable <stable@vger.kernel.org>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Todd Kjos <tkjos@google.com>
Link: https://lore.kernel.org/r/20211015233811.3532235-1-tkjos@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder.c