git: 419a11681c22 - stable/12 - dummynet: Fix mbuf tag allocation failure handling
Mark Johnston
markj at FreeBSD.org
Tue May 25 13:29:17 UTC 2021
The branch stable/12 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=419a11681c22ce12d3b9a4ab9ab45ff6b7c4ce83
commit 419a11681c22ce12d3b9a4ab9ab45ff6b7c4ce83
Author: Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-05-18 19:22:21 +0000
Commit: Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-05-25 13:29:00 +0000
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)
---
sys/netpfil/ipfw/dn_aqm_codel.c | 4 +---
sys/netpfil/ipfw/dn_aqm_pie.c | 6 +++---
sys/netpfil/ipfw/dn_sched_fq_codel.c | 4 +---
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 a095b33b0833..8e90dcdb1e5b 100644
--- a/sys/netpfil/ipfw/dn_aqm_codel.c
+++ b/sys/netpfil/ipfw/dn_aqm_codel.c
@@ -253,10 +253,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 c306a4caac9d..e106fd0121f3 100644
--- a/sys/netpfil/ipfw/dn_aqm_pie.c
+++ b/sys/netpfil/ipfw/dn_aqm_pie.c
@@ -543,11 +543,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 44610aaf9740..d2fe6a76f1cc 100644
--- a/sys/netpfil/ipfw/dn_sched_fq_codel.c
+++ b/sys/netpfil/ipfw/dn_sched_fq_codel.c
@@ -187,10 +187,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 2f61ca3de94e..c791ee333bc6 100644
--- a/sys/netpfil/ipfw/dn_sched_fq_pie.c
+++ b/sys/netpfil/ipfw/dn_sched_fq_pie.c
@@ -736,11 +736,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) {
More information about the dev-commits-src-all
mailing list