git: b50851e8ebfa - stable/14 - prison_proc_iterate(): make it work for prison0

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 10 Dec 2024 02:40:41 UTC
The branch stable/14 has been updated by kib:

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

commit b50851e8ebfa8acc77607a4ff1095ed6e4a56881
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-12-06 17:01:00 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-12-10 02:40:24 +0000

    prison_proc_iterate(): make it work for prison0
    
    PR:     283163
    
    (cherry picked from commit 831531a82e0f1d1d7b97e50c0587639322ed8d2e)
---
 sys/kern/kern_jail.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index a4bd27734e8e..c4e89774f18b 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -3051,8 +3051,7 @@ prison_proc_iterate(struct prison *pr, void (*cb)(struct proc *, void *),
 	FOREACH_PROC_IN_SYSTEM(p) {
 		PROC_LOCK(p);
 		if (p->p_state != PRS_NEW && p->p_ucred != NULL) {
-			for (ppr = p->p_ucred->cr_prison;
-			    ppr != &prison0;
+			for (ppr = p->p_ucred->cr_prison; ppr != NULL;
 			    ppr = ppr->pr_parent) {
 				if (ppr == pr) {
 					cb(p, cbarg);