diff options
author | Mark Johnston <markj@FreeBSD.org> | 2021-05-18 19:22:21 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2021-05-25 13:26:09 +0000 |
commit | b14db362bbd20e5a3d97d121c403b72473fdc733 (patch) | |
tree | 2dd6f630410b7da1a8df2bfcd8535fe02a7764d0 | |
parent | e53b671b4f75fe86ace1cb78566ccdbdb56aad01 (diff) | |
download | src-b14db362bbd20e5a3d97d121c403b72473fdc733.tar.gz src-b14db362bbd20e5a3d97d121c403b72473fdc733.zip |
dummynet: Fix mbuf tag allocation failure handling
PR: 255875, 255878, 255879, 255880
Reviewed by: donner, kp
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c4a6258d70f73c27d8f0c6233edbcc609791806b)
-rw-r--r-- | sys/netpfil/ipfw/dn_aqm_codel.c | 4 | ||||
-rw-r--r-- | sys/netpfil/ipfw/dn_aqm_pie.c | 6 | ||||
-rw-r--r-- | sys/netpfil/ipfw/dn_sched_fq_codel.c | 4 | ||||
-rw-r--r-- | sys/netpfil/ipfw/dn_sched_fq_pie.c | 6 |
4 files changed, 8 insertions, 12 deletions
diff --git a/sys/netpfil/ipfw/dn_aqm_codel.c b/sys/netpfil/ipfw/dn_aqm_codel.c index 4b921f0f52c8..a1f90461ecab 100644 --- a/sys/netpfil/ipfw/dn_aqm_codel.c +++ b/sys/netpfil/ipfw/dn_aqm_codel.c @@ -256,10 +256,8 @@ aqm_codel_enqueue(struct dn_queue *q, struct mbuf *m) if (mtag == NULL) mtag = m_tag_alloc(MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, sizeof(aqm_time_t), M_NOWAIT); - if (mtag == NULL) { - m_freem(m); + if (mtag == NULL) goto drop; - } *(aqm_time_t *)(mtag + 1) = AQM_UNOW; m_tag_prepend(m, mtag); diff --git a/sys/netpfil/ipfw/dn_aqm_pie.c b/sys/netpfil/ipfw/dn_aqm_pie.c index abd5bbf0eb9a..2d5d500e275c 100644 --- a/sys/netpfil/ipfw/dn_aqm_pie.c +++ b/sys/netpfil/ipfw/dn_aqm_pie.c @@ -542,11 +542,11 @@ aqm_pie_enqueue(struct dn_queue *q, struct mbuf* m) mtag = m_tag_alloc(MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, sizeof(aqm_time_t), M_NOWAIT); if (mtag == NULL) { - m_freem(m); t = DROP; + } else { + *(aqm_time_t *)(mtag + 1) = AQM_UNOW; + m_tag_prepend(m, mtag); } - *(aqm_time_t *)(mtag + 1) = AQM_UNOW; - m_tag_prepend(m, mtag); } if (t != DROP) { diff --git a/sys/netpfil/ipfw/dn_sched_fq_codel.c b/sys/netpfil/ipfw/dn_sched_fq_codel.c index 5580dd91bbfe..bc61be867d36 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_codel.c +++ b/sys/netpfil/ipfw/dn_sched_fq_codel.c @@ -189,10 +189,8 @@ codel_enqueue(struct fq_codel_flow *q, struct mbuf *m, struct fq_codel_si *si) if (mtag == NULL) mtag = m_tag_alloc(MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, sizeof(aqm_time_t), M_NOWAIT); - if (mtag == NULL) { - m_freem(m); + if (mtag == NULL) goto drop; - } *(aqm_time_t *)(mtag + 1) = AQM_UNOW; m_tag_prepend(m, mtag); diff --git a/sys/netpfil/ipfw/dn_sched_fq_pie.c b/sys/netpfil/ipfw/dn_sched_fq_pie.c index 257dada44345..809ca2b5f4e8 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_pie.c +++ b/sys/netpfil/ipfw/dn_sched_fq_pie.c @@ -734,11 +734,11 @@ pie_enqueue(struct fq_pie_flow *q, struct mbuf* m, struct fq_pie_si *si) mtag = m_tag_alloc(MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, sizeof(aqm_time_t), M_NOWAIT); if (mtag == NULL) { - m_freem(m); t = DROP; + } else { + *(aqm_time_t *)(mtag + 1) = AQM_UNOW; + m_tag_prepend(m, mtag); } - *(aqm_time_t *)(mtag + 1) = AQM_UNOW; - m_tag_prepend(m, mtag); } if (t != DROP) { |