From nobody Mon Sep 1 16:33:53 2025 X-Original-To: dev-commits-src-main@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 4cFvZn5t2Pz66p6j; Mon, 01 Sep 2025 16:33:53 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cFvZn52JVz441y; Mon, 01 Sep 2025 16:33:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756744433; 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=ICmxtC8xD4+oo4cnRfdTYhY8g177ISLHUigUjhZPZyc=; b=iOH/iGcbg19WnFHyCgLTKWoMRWl/bL7dn9S8VquKP5Yz/NLhZJqLa60TSTGt8wakum8xe8 vkOG/BdZ9oU44p7rWuPwxEW64mbJTbd2WShFKZlICDa1t9bN5wehvkwk7ZHE/nBMC33Pqy hhvBquBFifJT2hj1k02S/Pdd6j5m69JDPmSr5ZzymlWQmZ7ohKF/aDD4Li98UifuoCsmVN 142VjjW+2MlqdJrU7KZB0l/hJoT2so/jSFAa3HBLlFivNDSv8wH+BhVrPQQveKbVKsCMuM 9AGcTRP/InVHCWTyx0tu4LbF9v9oBfVLs4Fe2wiDyJ4AjEsu0qzN2BHAw4A+rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756744433; 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=ICmxtC8xD4+oo4cnRfdTYhY8g177ISLHUigUjhZPZyc=; b=ZD9yS7+Mw4p79ODaCavGykucKYjXCDSPtZRZG/cw75QswmQlppnBT32+G7fcN+XG2e6qx/ JIFqxITbyTjxZouAs8h4XyzlY6f5NyPPB/D4dYvkYtLEv9+bh3VDrpbozfm+byMQ56aOcd rAcCApIH3JmJkgA75PdWCQLdI+yz27VOyVv3t9c3dQANwm2XlEvtM416ndnYN64Hognq9c wV2zwDhU7XQOEtMjtFR5yfPc+ltau7yuA90tgiSFgZVf4FzqsUrVFHtqsskHFCHc2ULUJz GvB132JU0Yg0EMOq59Oo8ZDO5F2CJZp1RMS7SKh5l7OZAxjOPVQ6BQlzo7oaFw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756744433; a=rsa-sha256; cv=none; b=v/fwNhvI+uodVi9IsbzQd+O985VDlsy5xAihgpP8YWk3MI+9P9qp6M5xK3UVPKtCCO1MQH MueqISTF9iEbodQDzqa/AdGtdvgpYvyFhWFnLSmmcenjg79tcIQaMYG8S1BCjAsPpkKIub hInRnckEK/YKO7Q/eHta8KsDq+7/zl259eU4gmkQyrwy0EJ3XUUFsFv10Y/Ec0bRHl4PL0 eyHO3i3KHZDq0X5MdtOlfCsvaEa0y56jHvAknDxTIzQXshMWQ2+oP6L5S9w+X4bLW19cHp QTX5z3qs+l0pod7U6giNl0geEylEDxCXmXiSp5BjPQptoCS04/hwKMPu3DvLJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cFvZn4Ltqz16Z7; Mon, 01 Sep 2025 16:33:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 581GXrVh089754; Mon, 1 Sep 2025 16:33:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 581GXrn5089751; Mon, 1 Sep 2025 16:33:53 GMT (envelope-from git) Date: Mon, 1 Sep 2025 16:33:53 GMT Message-Id: <202509011633.581GXrn5089751@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: c8a5df48de6f - main - udp: don't leak mbuf if tunnel didn't consume and inpcb is gone List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8a5df48de6f2c5fada622af043f3c3fca88fca1 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=c8a5df48de6f2c5fada622af043f3c3fca88fca1 commit c8a5df48de6f2c5fada622af043f3c3fca88fca1 Author: Gleb Smirnoff AuthorDate: 2025-09-01 16:33:24 +0000 Commit: Gleb Smirnoff CommitDate: 2025-09-01 16:33:24 +0000 udp: don't leak mbuf if tunnel didn't consume and inpcb is gone Fixes: e1751ef896119d7372035b1b60f18a6342bd0e3b Reviewed by: tuexen, kp, markj Differential Revision: https://reviews.freebsd.org/D52170 --- sys/netinet/udp_usrreq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 3e6519118a40..4547699b6df5 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -258,8 +258,11 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, filtered = (*up->u_tun_func)(n, off, inp, (struct sockaddr *)&udp_in[0], up->u_tun_ctx); INP_RLOCK(inp); - if (in_pcbrele_rlocked(inp)) + if (in_pcbrele_rlocked(inp)) { + if (!filtered) + m_freem(n); return (1); + } if (filtered) { INP_RUNLOCK(inp); return (1);