Date: Sun, 9 May 2021 13:46:14 GMT From: Lutz Donnerhacke <donner@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 3da0d11afe08 - stable/11 - netgraph/ng_source: If queue is full, don't enqueue Message-ID: <202105091346.149DkE6l015309@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/11 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=3da0d11afe0807ccbbb9f447e6c814dce654d71d commit 3da0d11afe0807ccbbb9f447e6c814dce654d71d Author: Lutz Donnerhacke <donner@FreeBSD.org> AuthorDate: 2021-01-23 17:54:47 +0000 Commit: Lutz Donnerhacke <donner@FreeBSD.org> CommitDate: 2021-05-09 13:45:07 +0000 netgraph/ng_source: If queue is full, don't enqueue Submitted by: nc Reviewed by: donner, kp Differential Revision: https://reviews.freebsd.org/D23477 (cherry picked from commit d7dd28bb09fa51b9958a5dc288d2aeef56a67491) --- sys/netgraph/ng_source.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c index da8f42381ac3..8d1d05b5673f 100644 --- a/sys/netgraph/ng_source.c +++ b/sys/netgraph/ng_source.c @@ -284,7 +284,7 @@ ng_source_constructor(node_p node) NG_NODE_SET_PRIVATE(node, sc); sc->node = node; - sc->snd_queue.ifq_maxlen = 2048; /* XXX not checked */ + sc->snd_queue.ifq_maxlen = 2048; ng_callout_init(&sc->intr_ch); return (0); @@ -567,8 +567,11 @@ ng_source_rcvdata(hook_p hook, item_p item) } KASSERT(hook == sc->input, ("%s: no hook!", __func__)); - /* Enqueue packet. */ - /* XXX should we check IF_QFULL() ? */ + /* Enqueue packet if the queue isn't full. */ + if (_IF_QFULL(&sc->snd_queue)) { + NG_FREE_M(m); + return (ENOBUFS); + } _IF_ENQUEUE(&sc->snd_queue, m); sc->queueOctets += m->m_pkthdr.len; sc->last_packet = m;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105091346.149DkE6l015309>