From nobody Thu Sep 12 11:53:01 2024 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 4X4G661PfYz5WKpd; Thu, 12 Sep 2024 11:53:02 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X4G656S1Nz53HQ; Thu, 12 Sep 2024 11:53:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726141981; 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=tudeZe2/bkYBhaNX6qRj0xG4OdZo/nAfRCp4gVuoQjw=; b=L5HdCRlh1F9rwhPCfHGNTJPfbu5CmQFOhjZpVo3zo3bZiG66HJmTAIgLJzEtHT3gveuoxi 5HBoIRiV044GR49U7YkcWsLlFQLhwpymuydJiJsDpaGN6EBhQ7l1JHqRkGyTyFJxJOVoT5 TYWRLRDLaVUwtb91kRODfCVFugfFQ4m6x4C2vuljWxRxgJzrY988Cnrhc+jWUKuTYhz3/b 3nLms4TnpRA5/xqsiLnpHvpqFr8lQgIZZLCBTd/ZFZqtUQzSxJitczSyX8hgi93Pz01AaO 8wGSyIUp173X1ie+RZPuRj3iNqr4dHA7fCvddIYrcpKCCnuHCCNKdz9kbUiVRg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726141981; a=rsa-sha256; cv=none; b=bsDYwyLZ6tg9Vq6qw1gfwfMdUnFLv5sjgXgBU05raX68AzStqT+gRa4f1pC24sikDpXgfX y5OTSxyOoIscu7yodWQTb0reStc+eAleHIWHWmXMnQ83Ofs753wHnQzWAw+joGsuL9R37c 4+c5G3Yr71iqv2BGcqf74jru5Pkg3ZVQEsf5ds2q7b9SmywJQdjQjNpQXMdG1ELVD15Boh Z2sLVvfY/Am1w3ltgXmR4NLx9Qymldfu+W57duXoqnjNyczLK83Tg2b6mAw++XsZNOdauj 5+wJbfTs4bOjo4NpIF1DBXvUs1Sn2mN0v7s+Wi8oblr562zU2iW+vGLM+WHSNw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726141981; 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=tudeZe2/bkYBhaNX6qRj0xG4OdZo/nAfRCp4gVuoQjw=; b=x+5k/M2STk7JKywMU3SahmaLxHZ9xfJ57qCXDkw4dPA3mKwUUOYR0pSE4vqMhy1RcOWA4p tk/D9r0RyL40HzL3XlWMNz4ZAV38ZOmgvftRJCViu/+nM8SEZP53OPC7alvsbBHDEh/XNt KU5YLYQPnbx4qVKnpRk8YE4y8Jk5brNIGz08SnrGN+iE+BFrycNvKWGWtBY/p7m4lQz56V bWCaaPa1GjdRFAoHHc6dY2RPEiFy4hfT+NeGKcxgz/QXFVa+9E4hb92o4nWpWnqp9vEPP3 eQQ8sWsWleBYmr30wNHoMCDCCB5V/iWzSTm6qnzo97JTNkGtETmSo0n+Ritx5Q== 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 4X4G655B2Qz1D4w; Thu, 12 Sep 2024 11:53:01 +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 48CBr1C1080984; Thu, 12 Sep 2024 11:53:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48CBr1B1080981; Thu, 12 Sep 2024 11:53:01 GMT (envelope-from git) Date: Thu, 12 Sep 2024 11:53:01 GMT Message-Id: <202409121153.48CBr1B1080981@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 8f2519378501 - stable/14 - if_ovpn: ensure it's safe to modify the mbuf 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/stable/14 X-Git-Reftype: branch X-Git-Commit: 8f251937850142748cdf67a46630342934ff9f91 Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8f251937850142748cdf67a46630342934ff9f91 commit 8f251937850142748cdf67a46630342934ff9f91 Author: Kristof Provost AuthorDate: 2024-09-04 12:54:23 +0000 Commit: Kristof Provost CommitDate: 2024-09-12 07:57:04 +0000 if_ovpn: ensure it's safe to modify the mbuf PR: 280036 Reviewed by: ae MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46529 (cherry picked from commit 5644e2c6d47c6113a61ab7fc0776b7227677656a) --- sys/net/if_ovpn.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c index 7af669c69511..e550fb9921dc 100644 --- a/sys/net/if_ovpn.c +++ b/sys/net/if_ovpn.c @@ -2119,6 +2119,12 @@ ovpn_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, sc = ifp->if_softc; + m = m_unshare(m, M_NOWAIT); + if (m == NULL) { + OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1); + return (ENOBUFS); + } + OVPN_RLOCK(sc); SDT_PROBE1(if_ovpn, tx, transmit, start, m); @@ -2237,6 +2243,12 @@ ovpn_udp_input(struct mbuf *m, int off, struct inpcb *inp, M_ASSERTPKTHDR(m); + m = m_unshare(m, M_NOWAIT); + if (m == NULL) { + OVPN_COUNTER_ADD(sc, nomem_data_pkts_in, 1); + return (true); + } + OVPN_COUNTER_ADD(sc, transport_bytes_received, m->m_pkthdr.len - off); ohdrlen = sizeof(*ohdr) - sizeof(ohdr->auth_tag);