aboutsummaryrefslogtreecommitdiff
path: root/drivers/android
diff options
context:
space:
mode:
authorMartijn Coenen <maco@android.com>2017-03-07 15:51:18 +0100
committerMister Oyster <oysterized@gmail.com>2017-04-11 11:00:02 +0200
commitc72840ef1ed12536c9638d2657c8b8263675e263 (patch)
treed813b36fc5af88f63438e56a0bc8cf21cd3e563a /drivers/android
parent43700f033d587c126ffe009918f8a6ed25e43b78 (diff)
binder: use group leader instead of open thread
The binder allocator assumes that the thread that called binder_open will never die for the lifetime of that proc. That thread is normally the group_leader, however it may not be. Use the group_leader instead of current. Bug: 35707103 Test: Created test case to open with temporary thread Change-Id: Id693f74b3591f3524a8c6e9508e70f3e5a80c588 Signed-off-by: Todd Kjos <tkjos@google.com> Signed-off-by: Martijn Coenen <maco@android.com>
Diffstat (limited to 'drivers/android')
-rw-r--r--drivers/android/binder.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 93a9c85d2..a1389642b 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -4450,7 +4450,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
const char *failure_string;
struct binder_buffer *buffer;
- if (proc->tsk != current)
+ if (proc->tsk != current->group_leader)
return -EINVAL;
if ((vma->vm_end - vma->vm_start) > SZ_4M)
@@ -4551,8 +4551,8 @@ static int binder_open(struct inode *nodp, struct file *filp)
proc = kzalloc(sizeof(*proc), GFP_KERNEL);
if (proc == NULL)
return -ENOMEM;
- get_task_struct(current);
- proc->tsk = current;
+ get_task_struct(current->group_leader);
+ proc->tsk = current->group_leader;
INIT_LIST_HEAD(&proc->todo);
init_waitqueue_head(&proc->wait);
proc->default_priority = task_nice(current);