git: 9b48646ab366 - main - kern_fork: guard against NULL newproc on the failure path
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 Jun 2026 11:37:55 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=9b48646ab366dcf6089fac653eef963331aa1169
commit 9b48646ab366dcf6089fac653eef963331aa1169
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-06-10 10:29:05 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-06-10 11:37:23 +0000
kern_fork: guard against NULL newproc on the failure path
Reported and tested by: pho
Fixes: 85a65e393092 ("proc: add tree ref count")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
---
sys/kern/kern_fork.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 5318a737ea35..26e2510698e2 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1132,7 +1132,8 @@ fail1:
fail2:
if (vm2 != NULL)
vmspace_free(vm2);
- PROC_TREE_UNREF(newproc);
+ if (newproc != NULL)
+ PROC_TREE_UNREF(newproc);
if ((flags & RFPROCDESC) != 0 && fp_procdesc != NULL) {
fdclose(td, fp_procdesc, *fr->fr_pd_fd);
fdrop(fp_procdesc, td);