From nobody Mon Jul 03 19:32:51 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qvx0M2hpvz4lVbn; Mon, 3 Jul 2023 19:32:51 +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 4Qvx0M1w9Qz4CYG; Mon, 3 Jul 2023 19:32:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688412771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T37rNxhQP9Hz8LyDqiTppixfWV0uk1pJvo9HF1/jQ0o=; b=ZURGZp+HhR7ueWQ3rNRmszwdbwx27OxhnNz2QQEpR83uKYOwRCoo+SeWNFYKRXUlxJtDlr u73GVYJnmvVjcYCh98H49m0lCrI5PkHTmxw4A4bIwA0rmIhRg79nIdywQV0kNh7MfPJsQ8 4x211NthiblcCXhACIAEyxSLjg5DnW3TSmE/nlcTjIR37Pn2XSH9d1Ia4vbMU48LpDGvU2 AfXMd7yUPeRnUuulAfzPoBt/B2bjrZcYbwDKYWgP6570qVa3d9sjow9wSFTr2zHEb80F1/ vL/WJGYpXZCPg7/Q2Sy94C9SG7glRQqqu7co8FEyRPMf6vOYFrsrEQACNyX5xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688412771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T37rNxhQP9Hz8LyDqiTppixfWV0uk1pJvo9HF1/jQ0o=; b=tx/DKt+JKHromwCZXZYLXsXmg4NVlv56afcHgcbFjrz7mjbvOEpfnoLWXmSdmMu+52sVNZ DcPJr/LAH/js9SN2xGc/neGgGsexXsmHEybZiTuptWwdOAj9To22EGVi7+YXTIoH5iCgXz /XGnz8jNEgTr/oI2NAShyFL++5j7tyGoZxyP5p2DYtcwKFWk45Zyu0UFNXeP1fJE0M68Li bXaF2Sl3BnEXvxCrzL/mslSOZwyEismEu3Wu9rVi1SVCptFVxxIpWnUCwwjQwuwx8FaYiI HPhWrTWmgy5flR+Geuu16zdsHIf/rk/F4PtDwnL6Hm6uDb+HHxZ4qFAmit9eBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688412771; a=rsa-sha256; cv=none; b=Uw4uz7uwkU521+eStGsbphqHSAR30RuTYmiprR4gxt64rytbXdSgELYgf022+/lbiJYFPB UVIHs1fLSy+2ZiY2Nmi0dz57wDXXyuzgHbzAw3JKzMIsPlBYmC7bmBg3LVhxdOBjSRaQR6 aLzGEtl26hDnsviaqNXebWELxkVcYodU0ltDFml8iX2g3P9jqgnHG/coHc/a8lSfTkHPUG qyBdT9tgrkwbC+Yw4HkLs6LoJF2W269uGNVu2+N+cVT5bQG2H3lOUsBDByBFlSvymeYmoo LPozLumJYQhuTGZhZcIeMHd5ufbL++Jhi0F4IGBKjSrwW8Ci81y1LB+WsYCcXQ== 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 4Qvx0M0vCpz12wF; Mon, 3 Jul 2023 19:32:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 363JWpTb048007; Mon, 3 Jul 2023 19:32:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 363JWpfC048006; Mon, 3 Jul 2023 19:32:51 GMT (envelope-from git) Date: Mon, 3 Jul 2023 19:32:51 GMT Message-Id: <202307031932.363JWpfC048006@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d0b0424fa0ca - main - altq codel: do not insert the same mtag twice List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d0b0424fa0ca8fb239e00d6bdd5e6340b7a85e68 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d0b0424fa0ca8fb239e00d6bdd5e6340b7a85e68 commit d0b0424fa0ca8fb239e00d6bdd5e6340b7a85e68 Author: Kristof Provost AuthorDate: 2023-07-03 17:02:23 +0000 Commit: Kristof Provost CommitDate: 2023-07-03 19:32:33 +0000 altq codel: do not insert the same mtag twice If we're called on an mbuf that's passed through codel before it may already contain the MTAG_CODEL tag. The code accounts for this and does not allocate a new mtag. However, it inserts the mtag unconditionally. That is, it inserts the existing mtag a second time. When the mbuf later gets freed we iterate over the list of mtags to fee them one by one, and we'll end up freeing an mtag that's already been freed. Only insert the mtag if we've allocated a new one. If we found one there's no need to insert it again. See also: https://redmine.pfsense.org/issues/14497 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/altq/altq_codel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/net/altq/altq_codel.c b/sys/net/altq/altq_codel.c index be16a5aef3e5..5006920ca68d 100644 --- a/sys/net/altq/altq_codel.c +++ b/sys/net/altq/altq_codel.c @@ -289,16 +289,18 @@ codel_addq(struct codel *c, class_queue_t *q, struct mbuf *m) if (qlen(q) < qlimit(q)) { mtag = m_tag_locate(m, MTAG_CODEL, 0, NULL); - if (mtag == NULL) + if (mtag == NULL) { mtag = m_tag_alloc(MTAG_CODEL, 0, sizeof(uint64_t), M_NOWAIT); + if (mtag != NULL) + m_tag_prepend(m, mtag); + } if (mtag == NULL) { m_freem(m); return (-1); } enqueue_time = (uint64_t *)(mtag + 1); *enqueue_time = read_machclk(); - m_tag_prepend(m, mtag); _addq(q, m); return (0); }