mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-10 17:12:44 -10:00
pf: fix potential state key leak
If we fail to attach the new state keys in pf_state_key_attach() we are
expected to free both keys. Do so.
Note that in some scenarios both key are the same, so check for that
before freeing.
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D47495
This commit is contained in:
1 parent
fc595a6b76
commit
371bd29d4b
1 file changed
+3
-1
+3
-1
@@ -1433,7 +1433,9 @@ keyattach:
|
||||
s->timeout = PFTM_UNLINKED;
|
||||
PF_HASHROW_UNLOCK(ih);
|
||||
KEYS_UNLOCK();
|
||||
uma_zfree(V_pf_state_key_z, sk);
|
||||
uma_zfree(V_pf_state_key_z, skw);
|
||||
if (skw != sks)
|
||||
uma_zfree(V_pf_state_key_z, sks);
|
||||
if (idx == PF_SK_STACK)
|
||||
pf_detach_state(s);
|
||||
return (EEXIST); /* collision! */
|
||||
|
||||
Reference in new issue
Block a user