pf: States have at least two references
pf_unlink_state() releases a reference to the state without checking if this is the last reference. It can't be, because pf_state_insert() initialises it to two. KASSERT() that this is always the case. CID: 1347140
This commit is contained in:
parent
8917c34a82
commit
6701c43213
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=328313
@ -1613,6 +1613,7 @@ int
|
||||
pf_unlink_state(struct pf_state *s, u_int flags)
|
||||
{
|
||||
struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)];
|
||||
int last;
|
||||
|
||||
if ((flags & PF_ENTER_LOCKED) == 0)
|
||||
PF_HASHROW_LOCK(ih);
|
||||
@ -1653,7 +1654,8 @@ pf_unlink_state(struct pf_state *s, u_int flags)
|
||||
PF_HASHROW_UNLOCK(ih);
|
||||
|
||||
pf_detach_state(s);
|
||||
refcount_release(&s->refs);
|
||||
last = refcount_release(&s->refs);
|
||||
KASSERT(last == 0, ("Incorrect state reference count"));
|
||||
|
||||
return (pf_release_state(s));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user