ANDROID: fix ENOMEM check of binder_proc_ext

The check should be done against 'eproc' before it gets dereferenced.

Fixes: d49297739550 ("BACKPORT: binder: use euid from cred instead of using task")
Change-Id: Ief0c08212c4da8bdfdf628474de9dd30ee5a8db0
Signed-off-by: Carlos Llamas <cmllamas@google.com>
This commit is contained in:
Carlos Llamas 2024-09-07 01:47:39 +00:00 committed by Ksawlii
parent 4a0304ecc3
commit 2dadc3eb35

View file

@ -6093,9 +6093,9 @@ static int binder_open(struct inode *nodp, struct file *filp)
current->group_leader->pid, current->pid); current->group_leader->pid, current->pid);
eproc = kzalloc(sizeof(*eproc), GFP_KERNEL); eproc = kzalloc(sizeof(*eproc), GFP_KERNEL);
proc = &eproc->proc; if (eproc == NULL)
if (proc == NULL)
return -ENOMEM; return -ENOMEM;
proc = &eproc->proc;
spin_lock_init(&proc->inner_lock); spin_lock_init(&proc->inner_lock);
spin_lock_init(&proc->outer_lock); spin_lock_init(&proc->outer_lock);
get_task_struct(current->group_leader); get_task_struct(current->group_leader);