mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
ANDROID: binder: Clear binder and cookie when setting handle in flat binder struct
commit 4afb604e2d upstream.
Prevents leaking pointers between processes
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Martijn Coenen <maco@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
14f09e8e7c
commit
8910c33882
@@ -1578,7 +1578,9 @@ static void binder_transaction(struct binder_proc *proc,
|
|||||||
fp->type = BINDER_TYPE_HANDLE;
|
fp->type = BINDER_TYPE_HANDLE;
|
||||||
else
|
else
|
||||||
fp->type = BINDER_TYPE_WEAK_HANDLE;
|
fp->type = BINDER_TYPE_WEAK_HANDLE;
|
||||||
|
fp->binder = 0;
|
||||||
fp->handle = ref->desc;
|
fp->handle = ref->desc;
|
||||||
|
fp->cookie = 0;
|
||||||
binder_inc_ref(ref, fp->type == BINDER_TYPE_HANDLE,
|
binder_inc_ref(ref, fp->type == BINDER_TYPE_HANDLE,
|
||||||
&thread->todo);
|
&thread->todo);
|
||||||
|
|
||||||
@@ -1628,7 +1630,9 @@ static void binder_transaction(struct binder_proc *proc,
|
|||||||
return_error = BR_FAILED_REPLY;
|
return_error = BR_FAILED_REPLY;
|
||||||
goto err_binder_get_ref_for_node_failed;
|
goto err_binder_get_ref_for_node_failed;
|
||||||
}
|
}
|
||||||
|
fp->binder = 0;
|
||||||
fp->handle = new_ref->desc;
|
fp->handle = new_ref->desc;
|
||||||
|
fp->cookie = 0;
|
||||||
binder_inc_ref(new_ref, fp->type == BINDER_TYPE_HANDLE, NULL);
|
binder_inc_ref(new_ref, fp->type == BINDER_TYPE_HANDLE, NULL);
|
||||||
trace_binder_transaction_ref_to_ref(t, ref,
|
trace_binder_transaction_ref_to_ref(t, ref,
|
||||||
new_ref);
|
new_ref);
|
||||||
@@ -1682,6 +1686,7 @@ static void binder_transaction(struct binder_proc *proc,
|
|||||||
binder_debug(BINDER_DEBUG_TRANSACTION,
|
binder_debug(BINDER_DEBUG_TRANSACTION,
|
||||||
" fd %d -> %d\n", fp->handle, target_fd);
|
" fd %d -> %d\n", fp->handle, target_fd);
|
||||||
/* TODO: fput? */
|
/* TODO: fput? */
|
||||||
|
fp->binder = 0;
|
||||||
fp->handle = target_fd;
|
fp->handle = target_fd;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user