Author: glebius
Date: Mon May 18 15:05:12 2015
New Revision: 283061
URL: https://svnweb.freebsd.org/changeset/base/283061

Log:
  Don't dereference NULL is pf_get_mtag() fails.
  
  PR:           200222
  Submitted by: Franco Fichtner <franco opnsense.org>

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==============================================================================
--- head/sys/netpfil/pf/pf.c    Mon May 18 15:02:35 2015        (r283060)
+++ head/sys/netpfil/pf/pf.c    Mon May 18 15:05:12 2015        (r283061)
@@ -5903,13 +5903,14 @@ done:
                    ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) {
                        action = PF_DROP;
                        REASON_SET(&reason, PFRES_MEMORY);
+               } else {
+                       if (pqid || (pd.tos & IPTOS_LOWDELAY))
+                               pd.pf_mtag->qid = r->pqid;
+                       else
+                               pd.pf_mtag->qid = r->qid;
+                       /* Add hints for ecn. */
+                       pd.pf_mtag->hdr = h;
                }
-               if (pqid || (pd.tos & IPTOS_LOWDELAY))
-                       pd.pf_mtag->qid = r->pqid;
-               else
-                       pd.pf_mtag->qid = r->qid;
-               /* add hints for ecn */
-               pd.pf_mtag->hdr = h;
 
        }
 #endif /* ALTQ */
@@ -6332,13 +6333,14 @@ done:
                    ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) {
                        action = PF_DROP;
                        REASON_SET(&reason, PFRES_MEMORY);
+               } else {
+                       if (pd.tos & IPTOS_LOWDELAY)
+                               pd.pf_mtag->qid = r->pqid;
+                       else
+                               pd.pf_mtag->qid = r->qid;
+                       /* Add hints for ecn. */
+                       pd.pf_mtag->hdr = h;
                }
-               if (pd.tos & IPTOS_LOWDELAY)
-                       pd.pf_mtag->qid = r->pqid;
-               else
-                       pd.pf_mtag->qid = r->qid;
-               /* add hints for ecn */
-               pd.pf_mtag->hdr = h;
        }
 #endif /* ALTQ */
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to