]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
android/binder: use same_thread_group(proc->tsk, current) in binder_mmap()
authorOleg Nesterov <oleg@redhat.com>
Sun, 25 Jan 2026 16:07:20 +0000 (17:07 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 3 Feb 2026 16:21:25 +0000 (08:21 -0800)
With or without this change the checked condition can be falsely true if
proc->tsk execs, but this is fine: binder_alloc_mmap_handler() checks
vma->vm_mm == alloc->mm.

Link: https://lkml.kernel.org/r/aXY_uPYyUg4rwNOg@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

index dea701daabb027fd1dda97244489de84874b3460..b3b73303f84dc834be1722054aee44b757d6b570 100644 (file)
@@ -6015,7 +6015,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
 {
        struct binder_proc *proc = filp->private_data;
 
-       if (proc->tsk != current->group_leader)
+       if (!same_thread_group(proc->tsk, current))
                return -EINVAL;
 
        binder_debug(BINDER_DEBUG_OPEN_CLOSE,