dummynet: Fix mbuf tag allocation failure handling

PR:		255875, 255878, 255879, 255880
Reviewed by:	donner, kp
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30318
This commit is contained in:
Mark Johnston 2021-05-18 15:22:21 -04:00
parent 8cf912b017
commit c4a6258d70
4 changed files with 8 additions and 12 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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) {