From a03c6437cfe8318cdf980ac454cb73298d9d4d8e Mon Sep 17 00:00:00 2001 From: Carlos Llamas Date: Sat, 7 Sep 2024 01:47:39 +0000 Subject: [PATCH] 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 --- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index a54787f57eb3..43fb1c0c9034 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -5944,9 +5944,9 @@ static int binder_open(struct inode *nodp, struct file *filp) current->group_leader->pid, current->pid); eproc = kzalloc(sizeof(*eproc), GFP_KERNEL); - proc = &eproc->proc; - if (proc == NULL) + if (eproc == NULL) return -ENOMEM; + proc = &eproc->proc; spin_lock_init(&proc->inner_lock); spin_lock_init(&proc->outer_lock); get_task_struct(current->group_leader);