Commit a8cfa3bd authored by Arve Hjønnevåg's avatar Arve Hjønnevåg Committed by Jiri Slaby

ANDROID: binder: Clear binder and cookie when setting handle in flat binder struct

commit 4afb604e upstream.

Prevents leaking pointers between processes
Signed-off-by: default avatarArve Hjønnevåg <arve@android.com>
Signed-off-by: default avatarMartijn Coenen <maco@android.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 4d0ee2bb
......@@ -1541,7 +1541,9 @@ static void binder_transaction(struct binder_proc *proc,
fp->type = BINDER_TYPE_HANDLE;
else
fp->type = BINDER_TYPE_WEAK_HANDLE;
fp->binder = NULL;
fp->handle = ref->desc;
fp->cookie = NULL;
binder_inc_ref(ref, fp->type == BINDER_TYPE_HANDLE,
&thread->todo);
......@@ -1584,7 +1586,9 @@ static void binder_transaction(struct binder_proc *proc,
return_error = BR_FAILED_REPLY;
goto err_binder_get_ref_for_node_failed;
}
fp->binder = NULL;
fp->handle = new_ref->desc;
fp->cookie = NULL;
binder_inc_ref(new_ref, fp->type == BINDER_TYPE_HANDLE, NULL);
trace_binder_transaction_ref_to_ref(t, ref,
new_ref);
......@@ -1631,6 +1635,7 @@ static void binder_transaction(struct binder_proc *proc,
binder_debug(BINDER_DEBUG_TRANSACTION,
" fd %d -> %d\n", fp->handle, target_fd);
/* TODO: fput? */
fp->binder = NULL;
fp->handle = target_fd;
} break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment