From owner-dev-commits-src-all@freebsd.org Sun May 9 13:43:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3927A638712; Sun, 9 May 2021 13:43:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FdQPL18lHz3J6l; Sun, 9 May 2021 13:43:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A98C12BD1; Sun, 9 May 2021 13:43:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 149DhIVB014801; Sun, 9 May 2021 13:43:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 149DhHGq014800; Sun, 9 May 2021 13:43:17 GMT (envelope-from git) Date: Sun, 9 May 2021 13:43:17 GMT Message-Id: <202105091343.149DhHGq014800@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 16ed32cc4b02 - stable/12 - netgraph/ng_source: If queue is full, don't enqueue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 16ed32cc4b021e0a80635efe7cb617c9a538cff1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2021 13:43:18 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=16ed32cc4b021e0a80635efe7cb617c9a538cff1 commit 16ed32cc4b021e0a80635efe7cb617c9a538cff1 Author: Lutz Donnerhacke AuthorDate: 2021-01-23 17:54:47 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-09 13:42:39 +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 401548da65d0..4bde62e5898a 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;