mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 10:48:02 +00:00
kern: fix panic with disabled ttys
PR: 277240, 277329
Reviewed by: kib (earlier version)
Fixes: f1d0a0cbec
("jail: Fix information leak.")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44086
This commit is contained in:
parent
312b1076c6
commit
975d773082
|
@ -1315,7 +1315,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);
|
||||
|
@ -1328,8 +1329,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);
|
||||
|
|
Loading…
Reference in a new issue