Prevent race between pf_test() and pf_purge_expired_states().
authorsashan <sashan@openbsd.org>
Fri, 1 Dec 2023 10:28:32 +0000 (10:28 +0000)
committersashan <sashan@openbsd.org>
Fri, 1 Dec 2023 10:28:32 +0000 (10:28 +0000)
commit9d9f4dc6c833cb79d13f836581e3a781d06842e7
treeb3f03b0c79e94356c81d668a364e0c34273851c4
parente9fdf334956fd87d40cbe514c45adc04138b230a
Prevent race between pf_test() and pf_purge_expired_states().
Packets (callers to pf_test()) must alter pf_state::timeout
under protection of pf_state::mtx. We also have to make sure
the packet does not update pf_state::timeout when ::timeout
reaches PFTM_UNLINKED.

The first report came from Johan Huldtgren, but he is not
the single user who has noticed "st->timeout == PFTM_UNLINKED"
assert violation.

OK bluhm@
sys/net/pf.c