Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

android/binder: don't abuse current->group_leader

Patch series "don't abuse task_struct.group_leader", v2.

This series removes the usage of ->group_leader when it is "obviously
unnecessary".

I am going to move ->group_leader from task_struct to signal_struct or at
least add the new task_group_leader() helper. So I will send more
tree-wide changes on top of this series.


This patch (of 7):

Cleanup and preparation to simplify the next changes.

- Use current->tgid instead of current->group_leader->pid

- Use the value returned by get_task_struct() to initialize proc->tsk

Link: https://lkml.kernel.org/r/aXY_h8i78n6yD9JY@redhat.com
Link: https://lkml.kernel.org/r/aXY_ryGDwdygl1Tv@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Cc: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Christan König <christian.koenig@amd.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Felix Kuehling <felix.kuehling@amd.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>
Cc: Steven Price <steven.price@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Oleg Nesterov and committed by
Andrew Morton
33caa19f 427b2535

+4 -5
+3 -4
drivers/android/binder.c
··· 6046 6046 bool existing_pid = false; 6047 6047 6048 6048 binder_debug(BINDER_DEBUG_OPEN_CLOSE, "%s: %d:%d\n", __func__, 6049 - current->group_leader->pid, current->pid); 6049 + current->tgid, current->pid); 6050 6050 6051 6051 proc = kzalloc(sizeof(*proc), GFP_KERNEL); 6052 6052 if (proc == NULL) ··· 6055 6055 dbitmap_init(&proc->dmap); 6056 6056 spin_lock_init(&proc->inner_lock); 6057 6057 spin_lock_init(&proc->outer_lock); 6058 - get_task_struct(current->group_leader); 6059 - proc->tsk = current->group_leader; 6058 + proc->tsk = get_task_struct(current->group_leader); 6059 + proc->pid = current->tgid; 6060 6060 proc->cred = get_cred(filp->f_cred); 6061 6061 INIT_LIST_HEAD(&proc->todo); 6062 6062 init_waitqueue_head(&proc->freeze_wait); ··· 6075 6075 binder_alloc_init(&proc->alloc); 6076 6076 6077 6077 binder_stats_created(BINDER_STAT_PROC); 6078 - proc->pid = current->group_leader->pid; 6079 6078 INIT_LIST_HEAD(&proc->delivered_death); 6080 6079 INIT_LIST_HEAD(&proc->delivered_freeze); 6081 6080 INIT_LIST_HEAD(&proc->waiting_threads);
+1 -1
drivers/android/binder_alloc.c
··· 1233 1233 VISIBLE_IF_KUNIT void __binder_alloc_init(struct binder_alloc *alloc, 1234 1234 struct list_lru *freelist) 1235 1235 { 1236 - alloc->pid = current->group_leader->pid; 1236 + alloc->pid = current->tgid; 1237 1237 alloc->mm = current->mm; 1238 1238 mmgrab(alloc->mm); 1239 1239 mutex_init(&alloc->mutex);