git: 945995c5e3f1 - stable/15 - kern_pdwait(): print the process pointer through pd

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 16 Aug 2026 02:47:08 UTC
The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=945995c5e3f1a4985b4eb2160de952c3ee77d99c

commit 945995c5e3f1a4985b4eb2160de952c3ee77d99c
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-07-27 23:37:44 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-08-16 02:41:34 +0000

    kern_pdwait(): print the process pointer through pd
    
    (cherry picked from commit 2e259c209f6912bc99e18bbfb55dd10554b3b11d)
---
 sys/kern/kern_exit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 603e9503a261..eac381f90152 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1571,12 +1571,12 @@ kern_pdwait(struct thread *td, int fd, int *status,
 		goto exit_unlocked;
 
 	for (;;) {
+		sx_xlock(&proctree_lock);
 		/* We own a reference on the procdesc file. */
 		KASSERT(pd->pd_fpcount > 0,
 		    ("closed proc %p procdesc %p pd flags %#x",
-		    p, pd, pd->pd_flags));
+		    pd->pd_proc, pd, pd->pd_flags));
 
-		sx_xlock(&proctree_lock);
 		p = pd->pd_proc;
 		if (p == NULL) {
 			error = ESRCH;