Skip to content

Commit 880ac3b

Browse files
Martijn Coenenpundiramit
authored andcommitted
UPSTREAM: ANDROID: binder: prevent transactions into own process.
This can't happen with normal nodes (because you can't get a ref to a node you own), but it could happen with the context manager; to make the behavior consistent with regular nodes, reject transactions into the context manager by the process owning it. Reported-by: syzbot+09e05aba06723a94d43d@syzkaller.appspotmail.com Signed-off-by: Martijn Coenen <maco@android.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 7aa135fcf26377f92dc0680a57566b4c7f3e281b)
1 parent 62978d4 commit 880ac3b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/android/binder.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3002,6 +3002,14 @@ static void binder_transaction(struct binder_proc *proc,
30023002
else
30033003
return_error = BR_DEAD_REPLY;
30043004
mutex_unlock(&context->context_mgr_node_lock);
3005+
if (target_node && target_proc == proc) {
3006+
binder_user_error("%d:%d got transaction to context manager from process owning it\n",
3007+
proc->pid, thread->pid);
3008+
return_error = BR_FAILED_REPLY;
3009+
return_error_param = -EINVAL;
3010+
return_error_line = __LINE__;
3011+
goto err_invalid_target_handle;
3012+
}
30053013
}
30063014
if (!target_node) {
30073015
/*

0 commit comments

Comments
 (0)