binder: use group leader instead of open thread
authorTodd Kjos <tkjos@android.com>
Thu, 29 Jun 2017 19:01:36 +0000 (12:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2017 08:19:26 +0000 (10:19 +0200)
commit c4ea41ba195d01c9af66fb28711a16cc97caa9c5 upstream.

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.

Signed-off-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder.c

index 47ddfefe24431b1274cbac8f1eb1318a8d6e7a08..76650faca2f6b02974e539a24cab12767725d89b 100644 (file)
@@ -2966,8 +2966,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);