From nobody Mon Mar 4 00:27:46 2024 X-Original-To: dev-commits-src-branches@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 4Tp0025j5dz5CdKS; Mon, 4 Mar 2024 00:27:46 +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 4Tp0024xWWz4gXr; Mon, 4 Mar 2024 00:27:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709512066; 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=7RnyaE8Cameu374/OR5Kzh3f1odKBQpx4x+0rSVRuVY=; b=oUZzBGojIOEgpUmnlXQzmaZKHnYtEH6XdIn3xqJwcq6o4Ptd11zfuZ41h5l5+IdkTaqz2I KchFu0NxnN3QTOPawzsC/CNkwLzugwfNV47ZdQK57Qp1xlAClB69vO87fcXty5UqNv/mUC yN5XflQpqK1d2Vqx7YB8ZRk6u5Zc0dLziq5Voi+Ll4fh/WLiKWXuGj/OuCnGz9fGE2Alkn 55gDakD61E2LWwVZuVBmMwdw/KLdIAXG4F5Sw/I0Hy0dyJxlcHAxVvr/If6f+qYZXld0xv fNmuUE3M+tH2EHwXG7q3jz6PA30h2L6oWSCVLZVexu8Bgs1g/mSDDItq/C3wcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709512066; a=rsa-sha256; cv=none; b=JvknYKjGF/mvj6URjV6nsgbXChzqrvjCeTllLHseo2uD1MAXYn78RPTyVN1vIvi65V7F+e YAb5ZMsJhrNnszusR9HDxeqPNBjtzoQ50+F6QFx/R4PqbE0RqVhMMv2IFSkWc0dL30CaSU HseulhUSNCm3/R5fC9871IQ16fjMslJHYpG2lMnJvPrnyOrI+TmM42Fi+suvhAg8JBiREK eicmPaJRZ+MWG20h2eouExk15haup+82Laupn91nlgWROYIMFvBZuIcCweHzQnVUTEn5mw jB44xavz28PDaXRHoq8zjwlk7VxC3aqCWcWT27kgWjAXe2SPGxgYqH8jc3VH+w== 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=1709512066; 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=7RnyaE8Cameu374/OR5Kzh3f1odKBQpx4x+0rSVRuVY=; b=NGXnZBojdjSD2W0smplfgiK2kxfCYUDrd01wAYaECZy2T5Byxo272rYA+9rIGBG3rS0cWA 6zMa01SBMakm7vz88tWjneXQ27Js5AhlP5yTCaNnD7GzlkhlDBJNHEfBbC763vZ36RClQM a857789EyJDP3zBIzMOND3ZLzRbLGlpT4qTxadNRfqPvNZsR0JdlUd962b9nt4DuSgtEsg RrNrXAXNGEOBb1suSrMjm2SDvaqoNy1sD0z/3QA19jChz8AOx9hVuIZjXR9VXONn7NhI6B kowJGYoK4mxHK5//FXgl7+6a299l5mRozOEBMzt70Kdy2ypeUPR0bLdKyjmq0Q== 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 4Tp0022w7dz10xQ; Mon, 4 Mar 2024 00:27:46 +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 4240RkLQ042678; Mon, 4 Mar 2024 00:27:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4240RkA1042675; Mon, 4 Mar 2024 00:27:46 GMT (envelope-from git) Date: Mon, 4 Mar 2024 00:27:46 GMT Message-Id: <202403040027.4240RkA1042675@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: 7f387adb6996 - stable/14 - ipsec esp: avoid dereferencing freed secasindex List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/14 X-Git-Reftype: branch X-Git-Commit: 7f387adb6996c8fe93a280b97048d41bfd0daa1f Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7f387adb6996c8fe93a280b97048d41bfd0daa1f commit 7f387adb6996c8fe93a280b97048d41bfd0daa1f Author: Konstantin Belousov AuthorDate: 2024-02-25 10:30:48 +0000 Commit: Konstantin Belousov CommitDate: 2024-03-04 00:27:17 +0000 ipsec esp: avoid dereferencing freed secasindex (cherry picked from commit 1a56620b7958cac2b9048589cb730c46958ab539) --- sys/netipsec/xform_esp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/netipsec/xform_esp.c b/sys/netipsec/xform_esp.c index 16f7b24375fa..7ad6085db87f 100644 --- a/sys/netipsec/xform_esp.c +++ b/sys/netipsec/xform_esp.c @@ -508,6 +508,13 @@ esp_input_cb(struct cryptop *crp) xd = crp->crp_opaque; CURVNET_SET(xd->vnet); sav = xd->sav; + if (sav->state >= SADB_SASTATE_DEAD) { + /* saidx is freed */ + DPRINTF(("%s: dead SA %p spi %#x\n", __func__, sav, sav->spi)); + ESPSTAT_INC(esps_notdb); + error = ESRCH; + goto bad; + } skip = xd->skip; protoff = xd->protoff; cryptoid = xd->cryptoid;