Fix kernel diagnostic assertion "(sk->inp == NULL) || (sk->inp->inp_pf_sk
authorbluhm <bluhm@openbsd.org>
Wed, 21 Jun 2017 15:29:23 +0000 (15:29 +0000)
committerbluhm <bluhm@openbsd.org>
Wed, 21 Jun 2017 15:29:23 +0000 (15:29 +0000)
commitb8d05a73c6b9ef70fc673b6c2648670f4c833ed8
tree376d3cc829fb15514e5d2f8476e5d822788ab8b0
parent12f1d8c6c2302c3402caffd5f0d86fe770565355
Fix kernel diagnostic assertion "(sk->inp == NULL) || (sk->inp->inp_pf_sk
== NULL)".  The problem was that setting the inp pointer in the
statekey to NULL was delayed until the statekey refcounter reached
0.  So the inp could get linked to another statekey while an mbuf
in the socket buffer was keeping the refcounter at 1.  Set the
statekey inp pointer to NULL in pf_state_key_detach() immediately,
then the kassert can be even stricter.
OK sashan@
sys/net/pf.c