]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix a race in tty_signal_sessleader() with unlocked read of s_leader.
authorKonstantin Belousov <kib@FreeBSD.org>
Thu, 17 Dec 2020 19:51:39 +0000 (19:51 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Thu, 17 Dec 2020 19:51:39 +0000 (19:51 +0000)
commit551e205f6dfa469f4f32a166ee3fb691201d27a7
tree5d17034dc32d257c8c89e7adbe6e9f7ba2f65fef
parent0ebcbcc0efdd733b11311c840c47cc22f83c7408
Fix a race in tty_signal_sessleader() with unlocked read of s_leader.

Since we do not own the session lock, a parallel killjobc() might
reset s_leader to NULL after we checked it.  Read s_leader only once
and ensure that compiler is not allowed to reload.

While there, make access to t_session somewhat more pretty by using
local variable.

PR: 251915
Submitted by: Jakub Piecuch <j.piecuch96@gmail.com>
MFC after: 1 week
sys/kern/tty.c