aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2016-10-24 15:20:30 +0200
committerSasha Levin <alexander.levin@verizon.com>2016-11-23 20:59:49 -0500
commita64291d578dd900b3b0cf40ea7be70185ad06959 (patch)
tree4d5372dfc233635638400fe02305922c4c7ffc91
parent11924cba404d4bedcdfda6a2ddda3120890efa8b (diff)
downloadlinux-linaro-stable-a64291d578dd900b3b0cf40ea7be70185ad06959.tar.gz
ANDROID: binder: Clear binder and cookie when setting handle in flat binder struct
[ Upstream commit 4afb604e2d14d429ac9e1fd84b952602853b2df5 ] Prevents leaking pointers between processes Signed-off-by: Arve Hjønnevåg <arve@android.com> Signed-off-by: Martijn Coenen <maco@android.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
-rw-r--r--drivers/android/binder.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 939a9d18f4f1..6f086415727c 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -1578,7 +1578,9 @@ static void binder_transaction(struct binder_proc *proc,
fp->type = BINDER_TYPE_HANDLE;
else
fp->type = BINDER_TYPE_WEAK_HANDLE;
+ fp->binder = 0;
fp->handle = ref->desc;
+ fp->cookie = 0;
binder_inc_ref(ref, fp->type == BINDER_TYPE_HANDLE,
&thread->todo);
@@ -1628,7 +1630,9 @@ static void binder_transaction(struct binder_proc *proc,
return_error = BR_FAILED_REPLY;
goto err_binder_get_ref_for_node_failed;
}
+ fp->binder = 0;
fp->handle = new_ref->desc;
+ fp->cookie = 0;
binder_inc_ref(new_ref, fp->type == BINDER_TYPE_HANDLE, NULL);
trace_binder_transaction_ref_to_ref(t, ref,
new_ref);
@@ -1682,6 +1686,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 = 0;
fp->handle = target_fd;
} break;