From nobody Tue Nov 04 19:21:17 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 4d1JGQ1JRPz65D2m; Tue, 04 Nov 2025 19:21:18 +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 4d1JGP6cXSz41D9; Tue, 04 Nov 2025 19:21:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762284077; 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=yXGq4IW6bqBvSEDYLkD7exBd1pGsWuK83M6wjUQg5CI=; b=iDPNw7A8Iv4H5KTQAV7cN6P9T1Y80FYqJ5NGGrqHpwnxXKPNn1RmuGrIGIzgtaISrpTbzW AG0fxS9cVEMm6hs14Msl4iP1Trdv+E7Q8JY3lRqOJKGil4N88ZfJN4lvaViit/be8nksZB LnyyoRT4f7l+QOR82h95YG1xk67eAbThf4hg1OWloUSRkYCjgJGSXr8RxHESiuG35YduTi SK+IYQmxZpNRZFIPEs+bI+cHeARjuWULQr3UzIXHRm+xIRXiBaAWGA5TyH7Am20RFnb/ou CyKcyk9K9dVtx9lT8EZD4gEBDhQ3L6gTu6FrJ1oIITRg4B4+GmtIJvUm6KZIqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762284077; 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=yXGq4IW6bqBvSEDYLkD7exBd1pGsWuK83M6wjUQg5CI=; b=iA3Sez1WKqglM9FOAG1lXqUF3eC7j1lkdxQTemxn15QvGLQiBfq6fHy4j6qsZa6aB1s8hB eBirpHb9tpvaI3CUyhmWjTn3h24zXyK8GjKgjWeRE4ZBmu25OEEEdMxPVKYKlvVgUP8rjn tOZDdYJLRoGVRwzfLjDNNzwrL9STjx9DN7mphFfsLoUm3dVgU83JJzcki9vyqI6JkBYrjB UbfR6I0vNAw1OoQ2P2OupfCu1mFqUpOlRNyLANj5rS6t80KFWVRhZ4EbywAi9OkMFF9lOZ sgooO5brAeKpbi2y9Ze8x/MH5/ZlSM5powyoTTZKG9KNIRxlikW0oL/pJ8x94g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762284077; a=rsa-sha256; cv=none; b=b2CAmS3aUGg4SllOgqNW1RSDpA7R7G+qodm7znS6qL/rnQPGmfsU0MMvBvsPcgIFSNlMsq 5FQhAdEo3lOFxxNvx4UavQt5oJZW+lt68k/6mcUZ99O63EaHESq0xvwGW9hFd0kYYSWTL7 SZu1ZokYTdYqiMBPmPuddkkA8J3aebLkPhUlct3lNDYeWaIdpKERI4xlwHOC41RLoENlvE eZBcrYjA9p3EZgrFVp7Det6r54geywPaGyL/9hJN2sGsOFh/N+OT1jcnls3PSJ/YWCcDky XIwnovuCgwjIbiUa0M0wIOtK1F3pJl3F2U3VsZCeJNw6NIdhp8KNVNq/GOzN7Q== 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 4d1JGP6DKpz18Kn; Tue, 04 Nov 2025 19:21:17 +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 5A4JLHS9048219; Tue, 4 Nov 2025 19:21:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5A4JLHA3048216; Tue, 4 Nov 2025 19:21:17 GMT (envelope-from git) Date: Tue, 4 Nov 2025 19:21:17 GMT Message-Id: <202511041921.5A4JLHA3048216@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 4accefc998e7 - main - ipsec_offload: do not leak drv_spi unr 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4accefc998e731581549163cf1a582948b2ad0de Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4accefc998e731581549163cf1a582948b2ad0de commit 4accefc998e731581549163cf1a582948b2ad0de Author: Konstantin Belousov AuthorDate: 2025-10-30 14:50:22 +0000 Commit: Konstantin Belousov CommitDate: 2025-11-04 19:20:39 +0000 ipsec_offload: do not leak drv_spi unr in the ipsec_accel_sa_newkey_cb() when the SA offload is only enabled on a specific different interface, not the current one. Also remove no longer relevant XXX comment. Noted and reviewed by: slavash Sponsored by: NVidia networking MFC after: 1 week --- sys/netipsec/ipsec_offload.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sys/netipsec/ipsec_offload.c b/sys/netipsec/ipsec_offload.c index 59a107881676..3583fc50f51b 100644 --- a/sys/netipsec/ipsec_offload.c +++ b/sys/netipsec/ipsec_offload.c @@ -289,19 +289,18 @@ ipsec_accel_sa_newkey_cb(if_t ifp, void *arg) be32toh(tq->sav->spi), tq->sav->flags, tq->sav->seq); priv = NULL; drv_spi = alloc_unr(drv_spi_unr); - if (tq->sav->accel_ifname != NULL && - strcmp(tq->sav->accel_ifname, if_name(ifp)) != 0) { - error = ipsec_accel_handle_sav(tq->sav, - ifp, drv_spi, priv, IFP_HS_REJECTED, NULL); - goto out; - } if (drv_spi == -1) { - /* XXXKIB */ dprintf("ipsec_accel_sa_install_newkey: cannot alloc " "drv_spi if %s spi %#x\n", if_name(ifp), be32toh(tq->sav->spi)); return (0); } + if (tq->sav->accel_ifname != NULL && + strcmp(tq->sav->accel_ifname, if_name(ifp)) != 0) { + error = ipsec_accel_handle_sav(tq->sav, + ifp, drv_spi, priv, IFP_HS_REJECTED, NULL); + goto out; + } error = ifp->if_ipsec_accel_m->if_sa_newkey(ifp, tq->sav, drv_spi, &priv); if (error != 0) {