mirror of
https://github.com/opnsense/src.git
synced 2026-02-18 18:20:26 -05:00
pf: explicitly NULL state key pointers
After the pf_state_insert() call we may not use these pointers again.
Explicitly NULL them to ensure we don't.
Also NULL them out if we free the keys directly.
Reviewed by: glebius, markj
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D49553
(cherry picked from commit 592418343348bcf4355c249f53cff89ed90ea1f5)
This commit is contained in:
parent
8b9d1dc82a
commit
b89bc49a63
1 changed files with 4 additions and 0 deletions
|
|
@ -1629,6 +1629,7 @@ pf_state_insert(struct pfi_kkif *kif, struct pfi_kkif *orig_kif,
|
|||
/* Returns with ID locked on success. */
|
||||
if ((error = pf_state_key_attach(skw, sks, s)) != 0)
|
||||
return (error);
|
||||
skw = sks = NULL;
|
||||
|
||||
ih = &V_pf_idhash[PF_IDHASH(s)];
|
||||
PF_HASHROW_ASSERT(ih);
|
||||
|
|
@ -5064,6 +5065,7 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, struct pfi_kkif *kif,
|
|||
action = pf_create_state(r, nr, a, pd, nsn, nk, sk, m, off,
|
||||
sport, dport, &rewrite, kif, sm, tag, bproto_sum, bip_sum,
|
||||
hdrlen, &match_rules);
|
||||
sk = nk = NULL;
|
||||
if (action != PF_PASS) {
|
||||
pd->act.log |= PF_LOG_FORCE;
|
||||
if (action == PF_DROP &&
|
||||
|
|
@ -5081,6 +5083,7 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, struct pfi_kkif *kif,
|
|||
|
||||
uma_zfree(V_pf_state_key_z, sk);
|
||||
uma_zfree(V_pf_state_key_z, nk);
|
||||
sk = nk = NULL;
|
||||
}
|
||||
|
||||
/* copy back packet headers if we performed NAT operations */
|
||||
|
|
@ -5294,6 +5297,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a,
|
|||
goto drop;
|
||||
} else
|
||||
*sm = s;
|
||||
sk = nk = NULL;
|
||||
|
||||
if (tag > 0)
|
||||
s->tag = tag;
|
||||
|
|
|
|||
Loading…
Reference in a new issue