aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2022-01-28 10:10:04 +0000
committerKristof Provost <kp@FreeBSD.org>2022-01-28 22:09:08 +0000
commit9dac026822ab57b544ee28b66a00e400b5ca9a99 (patch)
tree65864dbfd8b77b34e1c325b64056bee9364622c1
parent703e533da5e2e4743d38bbf4605fec041bc69976 (diff)
downloadsrc-9dac026822ab57b544ee28b66a00e400b5ca9a99.tar.gz
src-9dac026822ab57b544ee28b66a00e400b5ca9a99.zip
dummynet: dn_dequeue() may return NULL
If there are no more entries, or if we fail to restore the rcvif of a queued mbuf dn_dequeue() can return NULL. Cope with this. Reviewed by: glebius Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D34078
-rw-r--r--sys/netpfil/ipfw/dn_sched_wf2q.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/netpfil/ipfw/dn_sched_wf2q.c b/sys/netpfil/ipfw/dn_sched_wf2q.c
index 7285df0d1d7d..c8a401193811 100644
--- a/sys/netpfil/ipfw/dn_sched_wf2q.c
+++ b/sys/netpfil/ipfw/dn_sched_wf2q.c
@@ -243,6 +243,8 @@ wf2qp_dequeue(struct dn_sch_inst *_si)
q = HEAP_TOP(sch)->object;
alg_fq = (struct wf2qp_queue *)q;
m = dn_dequeue(q);
+ if (m == NULL)
+ return NULL;
heap_extract(sch, NULL); /* Remove queue from heap. */
si->V += (uint64_t)(m->m_pkthdr.len) * si->inv_wsum;
alg_fq->S = alg_fq->F; /* Update start time. */