]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
android/binder: don't abuse current->group_leader
authorOleg Nesterov <oleg@redhat.com>
Sun, 25 Jan 2026 16:07:11 +0000 (17:07 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 3 Feb 2026 16:21:25 +0000 (08:21 -0800)
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>
drivers/android/binder.c
drivers/android/binder_alloc.c

index 535fc881c8daa7f64164fdac108a15c215449357..dea701daabb027fd1dda97244489de84874b3460 100644 (file)
@@ -6046,7 +6046,7 @@ static int binder_open(struct inode *nodp, struct file *filp)
        bool existing_pid = false;
 
        binder_debug(BINDER_DEBUG_OPEN_CLOSE, "%s: %d:%d\n", __func__,
-                    current->group_leader->pid, current->pid);
+                    current->tgid, current->pid);
 
        proc = kzalloc(sizeof(*proc), GFP_KERNEL);
        if (proc == NULL)
@@ -6055,8 +6055,8 @@ static int binder_open(struct inode *nodp, struct file *filp)
        dbitmap_init(&proc->dmap);
        spin_lock_init(&proc->inner_lock);
        spin_lock_init(&proc->outer_lock);
-       get_task_struct(current->group_leader);
-       proc->tsk = current->group_leader;
+       proc->tsk = get_task_struct(current->group_leader);
+       proc->pid = current->tgid;
        proc->cred = get_cred(filp->f_cred);
        INIT_LIST_HEAD(&proc->todo);
        init_waitqueue_head(&proc->freeze_wait);
@@ -6075,7 +6075,6 @@ static int binder_open(struct inode *nodp, struct file *filp)
        binder_alloc_init(&proc->alloc);
 
        binder_stats_created(BINDER_STAT_PROC);
-       proc->pid = current->group_leader->pid;
        INIT_LIST_HEAD(&proc->delivered_death);
        INIT_LIST_HEAD(&proc->delivered_freeze);
        INIT_LIST_HEAD(&proc->waiting_threads);
index 979c96b74cad36b1e1fbf0bba33282f9f526fff4..145ed5f14cdb0bffbee25bdfb96b8ace165d0f7b 100644 (file)
@@ -1233,7 +1233,7 @@ static struct shrinker *binder_shrinker;
 VISIBLE_IF_KUNIT void __binder_alloc_init(struct binder_alloc *alloc,
                                          struct list_lru *freelist)
 {
-       alloc->pid = current->group_leader->pid;
+       alloc->pid = current->tgid;
        alloc->mm = current->mm;
        mmgrab(alloc->mm);
        mutex_init(&alloc->mutex);