View | Details | Raw Unified | Return to bug 251915
Collapse All | Expand All

(-)b/sys/kern/tty.c (-2 / +7 lines)
Lines 69-74 __FBSDID("$FreeBSD$"); Link Here
69
69
70
#include <fs/devfs/devfs.h>
70
#include <fs/devfs/devfs.h>
71
71
72
#include <machine/atomic.h>
72
#include <machine/stdarg.h>
73
#include <machine/stdarg.h>
73
74
74
static MALLOC_DEFINE(M_TTY, "tty", "tty device");
75
static MALLOC_DEFINE(M_TTY, "tty", "tty device");
Lines 1482-1489 tty_signal_sessleader(struct tty *tp, int sig) Link Here
1482
	tp->t_flags &= ~TF_STOPPED;
1483
	tp->t_flags &= ~TF_STOPPED;
1483
	tp->t_termios.c_lflag &= ~FLUSHO;
1484
	tp->t_termios.c_lflag &= ~FLUSHO;
1484
1485
1485
	if (tp->t_session != NULL && tp->t_session->s_leader != NULL) {
1486
	/*
1486
		p = tp->t_session->s_leader;
1487
	 * Load s_leader exactly once to avoid TOCTOU races.
1488
	 * Note that we are not holding t_session's lock for the read.
1489
	 */
1490
	if (tp->t_session != NULL &&
1491
	    (p = atomic_load_ptr(&tp->t_session->s_leader)) != NULL) {
1487
		PROC_LOCK(p);
1492
		PROC_LOCK(p);
1488
		kern_psignal(p, sig);
1493
		kern_psignal(p, sig);
1489
		PROC_UNLOCK(p);
1494
		PROC_UNLOCK(p);

Return to bug 251915