HomeFreeBSD

pf: ensure states passed to pf_free_state() are always unlinked

Description

pf: ensure states passed to pf_free_state() are always unlinked

In pf_create_state() we can end up deleting the state immediately. This
can happen if we fail to map the relevant addresses or fail
normalization or fail to insert it into the state table.
If that happens we delete the state again with pf_free_state(). However,
this asserts that the state must be unlinked.

It's correct to simply set the state to PFTM_UNLINKED because we've not
yet linked it.

Submitted by: Mateusz Guzik <mjg@FreeBSD.org>
Reviewed by: scottl
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31752

(cherry picked from commit a0c64a443e4cae67a5eea3a61a47d746866de3ee)

Details

Provenance
kpAuthored on Sep 3 2021, 7:36 AM
Reviewer
scottl
Differential Revision
D31752: pf: ensure states passed to pf_free_state() are always unlinked
Parents
rGa83a49502989: dtrace: fix ipfw_rule_info_t translator
Branches
Unknown
Tags
Unknown