Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Aug 2026 15:16:13 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 13979cac4f19 - stable/14 - kthread: Fix a thread leak
Message-ID:  <6a7353bd.45133.31d4276d@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=13979cac4f19741b48f8e597f5ef9a5ee2c63697

commit 13979cac4f19741b48f8e597f5ef9a5ee2c63697
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-24 20:04:45 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-08-05 15:15:14 +0000

    kthread: Fix a thread leak
    
    Fixes:          963629923308 ("kthread_add(): do not allow to attach the thread to a dead or dying process")
    Reviewed by:    kib
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D58433
    
    (cherry picked from commit c7917e72fe80e2e168b3812718b5fcd497c0e3b8)
---
 sys/kern/kern_kthread.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index 00a264d57a21..d13986809a69 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -283,6 +283,7 @@ kthread_add1(void (*func)(void *), void *arg, struct proc *p,
 	PROC_LOCK(p);
 	if (p->p_state == PRS_ZOMBIE || (p->p_flag2 & P2_WEXIT) != 0) {
 		PROC_UNLOCK(p);
+		thread_free(newtd);
 		return (ESRCH);
 	}
 	oldtd = FIRST_THREAD_IN_PROC(p);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a7353bd.45133.31d4276d>