From nobody Fri Jul 28 01:26:27 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 4RBqjH6x7vz4pTht; Fri, 28 Jul 2023 01:26:27 +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 4RBqjH5l5Cz3rSp; Fri, 28 Jul 2023 01:26:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690507587; 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=X98//q5kc1OgxfSIp65yBlOfxpI/04oKEvlRfBHf2fk=; b=ZZfnrg5JSUeiDSNsc3sxmZWwosJjHL51v7SVYiYl2t1osQ1j91MYJD6LD34KJmhA9eTKBU ULlZFRdfG6UksUR7b+s0VPzF8U4AcF9TRA6LzcU/3ApGWZM7FvheVKjjqJV70qgUZlGvLl RqSeSe+LKhCD4aAJhpBSAelBo5pXEqlIBc31ByggZoIQOlddJv71NWwgn+5yLu/YFLO30m EHXTAUUGYbl0KdOsWuSGtSYNQQ9I6ur1IgLvXRFD6NP9J4T1EB4N8WW/+KdqU9eB4I5IiB nGzE3Z7WPJBBbbr4RjVo6V73qxqcL5Jd26u+cvzSIeDUdBzEAzHNtEfEO4Q3ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690507587; 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=X98//q5kc1OgxfSIp65yBlOfxpI/04oKEvlRfBHf2fk=; b=TahCA3dqNWmo18rYsINvNyWXUhxgjweIf7V2uNlFfRizucLfF0Sq6UPFg58a6qhR1+QdFN ToHJU4ouT9VCayQ0uD3152UZGRx+67tJuatzSYuGyPyv6fL0Iae/jfz0lrbag/84cX0u1Y n33HesIcX8X/nQ1/N6K8Cvb1qYQSjuLTx+JgmI24dczxBBPZzRvHRmJTvlcopLpX2Bgwp4 kNRYcx3fLx0o8mMaHdbdLaH+92ltrmygp2W30J+ypzMEQlshS6Doh4iQTEmCYGCQ161KCs GkLYxeVJQiUAqgM6E0HMhY53MTl7CsCbcfOQE/oRJR16vU/5VEOjbCpocPQ14g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690507587; a=rsa-sha256; cv=none; b=Z2j0J9u9z0vJIiOY8jjtRGfOqD4zm2rEPKpU/6M+VE761ajEJ9btH9/X242+51bAodUmqq 4loov6k6QV2Q5xMHWBMGQ1CDEqmGup1ATJlYHx6KDrvhL9xx4ZxvtZxit1T/OcgEcmbnvp 6WYa9WCFKrbRLAYX4fg/DiJTaqe7W90X52m6kcktWhGFkVSB5EIqLiI1atEK86xvc/wN4Y NUoZMaDhCt1vQ+Jd5Bq1Koul7AwZQjAqDLy9tHQND+r5BlFu7dphl0M6C3PkO9+Cr777PL u+ZoDKjc1OXSb9gQ0+BIMJgmLRa+Z51T3fEPmw2aaQdVV/CXEtX8eQeb0IzIBQ== 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 4RBqjH4Z9DzXcr; Fri, 28 Jul 2023 01:26:27 +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 36S1QRo1000567; Fri, 28 Jul 2023 01:26:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36S1QRTM000566; Fri, 28 Jul 2023 01:26:27 GMT (envelope-from git) Date: Fri, 28 Jul 2023 01:26:27 GMT Message-Id: <202307280126.36S1QRTM000566@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 7b335e9f690e - stable/13 - ip output: ensure that mbufs are mapped if ipsec is enabled 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7b335e9f690e77841e3eb7dbf3403429b10fe222 Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7b335e9f690e77841e3eb7dbf3403429b10fe222 commit 7b335e9f690e77841e3eb7dbf3403429b10fe222 Author: Konstantin Belousov AuthorDate: 2023-07-20 12:08:24 +0000 Commit: Konstantin Belousov CommitDate: 2023-07-28 01:14:01 +0000 ip output: ensure that mbufs are mapped if ipsec is enabled PR: 272616 (cherry picked from commit bc310a95c58a3c570ed7e5103371453881e36ba1) --- sys/netinet/ip_output.c | 6 ++++++ sys/netinet6/ip6_output.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 60aac79886c3..9b8e3b3eff7f 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -677,6 +677,12 @@ again: sendit: #if defined(IPSEC) || defined(IPSEC_SUPPORT) if (IPSEC_ENABLED(ipv4)) { + m = mb_unmapped_to_ext(m); + if (m == NULL) { + IPSTAT_INC(ips_odropped); + error = ENOBUFS; + goto bad; + } if ((error = IPSEC_OUTPUT(ipv4, m, inp)) != 0) { if (error == EINPROGRESS) error = 0; diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index f455c5ccbea2..88d7b2153991 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -461,6 +461,12 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, * XXX: need scope argument. */ if (IPSEC_ENABLED(ipv6)) { + m = mb_unmapped_to_ext(m); + if (m == NULL) { + IP6STAT_INC(ip6s_odropped); + error = ENOBUFS; + goto bad; + } if ((error = IPSEC_OUTPUT(ipv6, m, inp)) != 0) { if (error == EINPROGRESS) error = 0;