Date: Thu, 29 Feb 2024 00:29:43 GMT From: Ed Maste <emaste@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 8d22744f5be1 - stable/14 - kern: fix panic with disabled ttys Message-ID: <202402290029.41T0ThmN097580@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8d22744f5be165a2a82a2a204789e44bbdc5a2ee commit 8d22744f5be165a2a82a2a204789e44bbdc5a2ee Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2024-02-26 15:38:45 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-02-29 00:29:13 +0000 kern: fix panic with disabled ttys PR: 277240, 277329 Reviewed by: kib (earlier version) Fixes: f1d0a0cbecf2 ("jail: Fix information leak.") MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44086 (cherry picked from commit 975d7730828a8bde28c2a0092b6e95c4c4e22f34) --- sys/kern/tty.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/kern/tty.c b/sys/kern/tty.c index eaf6fe98fe2e..6848fbf558b0 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1313,7 +1313,8 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS) struct xtty *xtlist, *xt; struct tty *tp; struct proc *p; - int cansee, error; + int error; + bool cansee; sx_slock(&tty_list_sx); lsize = tty_list_count * sizeof(struct xtty); @@ -1326,8 +1327,8 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS) TAILQ_FOREACH(tp, &tty_list, t_list) { tty_lock(tp); - if (tp->t_session != NULL) { - p = tp->t_session->s_leader; + if (tp->t_session != NULL && + (p = atomic_load_ptr(&tp->t_session->s_leader)) != NULL) { PROC_LOCK(p); cansee = (p_cansee(td, p) == 0); PROC_UNLOCK(p);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402290029.41T0ThmN097580>