Author: kp
Date: Sun Mar  5 13:14:18 2017
New Revision: 314702
URL: https://svnweb.freebsd.org/changeset/base/314702

Log:
  pf: Fix a crash in low-memory situations
  
  If the call to pf_state_key_clone() in pf_get_translation() fails (i.e. 
there's
  no more memory for it) it frees skp. This is wrong, because skp is a
  pf_state_key **, so we need to free *skp, as is done later in the function.
  Getting it wrong means we try to free a stack variable of the calling
  pf_test_rule() function, and we panic.

Modified:
  stable/11/sys/netpfil/pf/pf_lb.c

Modified: stable/11/sys/netpfil/pf/pf_lb.c
==============================================================================
--- stable/11/sys/netpfil/pf/pf_lb.c    Sun Mar  5 12:06:45 2017        
(r314701)
+++ stable/11/sys/netpfil/pf/pf_lb.c    Sun Mar  5 13:14:18 2017        
(r314702)
@@ -553,7 +553,7 @@ pf_get_translation(struct pf_pdesc *pd, 
                return (NULL);
        *nkp = pf_state_key_clone(*skp);
        if (*nkp == NULL) {
-               uma_zfree(V_pf_state_key_z, skp);
+               uma_zfree(V_pf_state_key_z, *skp);
                *skp = NULL;
                return (NULL);
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to