Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Mar 2024 00:28:15 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: bf58a77ae125 - stable/13 - ipsec esp: avoid dereferencing freed secasindex
Message-ID:  <202403040028.4240SFjc042895@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=bf58a77ae125f4e5fd4a2c9bea42ee44340d3736

commit bf58a77ae125f4e5fd4a2c9bea42ee44340d3736
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-02-25 10:30:48 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-03-04 00:27:56 +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 37a5c5f4fd8b..a0efea0e5323 100644
--- a/sys/netipsec/xform_esp.c
+++ b/sys/netipsec/xform_esp.c
@@ -500,6 +500,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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202403040028.4240SFjc042895>