From nobody Thu Oct 29 23:37:31 2026 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 4jG0yN3GYxz6xqxb for ; Thu, 29 Oct 2026 23:37:32 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jG0yM5ZWvz4t6K for ; Thu, 29 Oct 2026 23:37:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793317051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9SH0kz8e9fx5nhHdbMNTpA8y+tVLdS8qoP3n+Mj4zak=; b=ngurThHv3/hUz7Mvs96u7B9lNEkwwHGwP26xpRB7C4rY+xZ41UFqHpECm/vVOGySZcDCl0 bfuB+j2BhDhyvJE52ndYtFgR7hi2HLvslEExCfJ8DxE+pPvY5srwjdxpM/HZNSVRGLG21W fXfsQ/y7Ariy0HQD5gxgE/UKb5+p9yfuER29k6BI7/geypGefq1S0nkDtRKC+XOV0HKAKt p+4bT99n3R7zLvHzXbZlkSqUfcqRl+JgEaeQN2IEck5aE8XYVJ0xu4Uh4mIuP39KD6TyjK 0YO75iojNMqSJhSEoqhrqj+Qvdf/3bvIHu6IXA0cbYSPFg0A2AxKD+UTPRRKrQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793317051; b=iOC/txLHnFRQhYL/haRI3joVicAupWJ1+l1GAqobQrPC0rFv/SkaaqUZ8neAedzfVE1Flq nbJrJqOO2hxwLbjowaZbaGRfu8sWOBgMNnzZSnkJhygzT7byaM+hFg+H7FLe0dxz63yhm3 rmUE9aY3rfMRZLt0y4Xg2e89d43uMzGrGNEM3Oa9OohmaQSbz8oJVeRtYLvj1CrupCpHsJ bH3zjkJ2nU7o3jvdJP5aumuXcBZVI+2RyfV5V3P9YPCiLE8A5M//7jHRkF+tCf+xU58Fuu R3z03OBs2Gngq5XY1kcoW5O4CTBIQNUS4eD0UtEX14aqhdO8e5hzT+j3g54qaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793317051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9SH0kz8e9fx5nhHdbMNTpA8y+tVLdS8qoP3n+Mj4zak=; b=PnNLCOHHfGE5q1zrGv42IR1SCCGV8nj4KyQGI6Up32xx5GDDVgIpFpfB/lK/xW7plLMosy 7wtc53iNHCejZ4d6lKgR17nor/TY68dxAZXYp+LqyuZl85OuPj2gdSeLCbEMCiI10uB5vv s8VtrkZTmTxyf6VrnCgrwVR675IeEpgxVXlOPHNrwGa45adLvo8IW0ukfNQBhJokgKoK4+ q+dn3+UbWhH1OToOGvrzy2T4SOOMWuUGbmWpjd06q1pIOaw2fEXbnJnXfQQgjJBCurdoij wRJTv0NVvKBrmsya4w4OWZC3JNrwEzs5JZ5DfIWsYliaRLrFewffheCLZvc8kA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jG0yM5517z121G for ; Thu, 29 Oct 2026 23:37:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39e50 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 29 Oct 2026 23:37:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Sumit Saxena From: Kevin Bowling Subject: git: e0cea2ad6463 - stable/15 - if_bnxt: ktls: Reject new kTLS sessions once driver is detaching List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: Commits to the stable branches of the FreeBSD src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: e0cea2ad6463f44d5e0e40d6187d5efb3f63ba6a Auto-Submitted: auto-generated Date: Thu, 29 Oct 2026 23:37:31 +0000 Message-Id: <6ae3d8bb.39e50.3365d07c@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=e0cea2ad6463f44d5e0e40d6187d5efb3f63ba6a commit e0cea2ad6463f44d5e0e40d6187d5efb3f63ba6a Author: Sumit Saxena AuthorDate: 2026-07-31 15:53:02 +0000 Commit: Kevin Bowling CommitDate: 2026-10-29 23:25:51 +0000 if_bnxt: ktls: Reject new kTLS sessions once driver is detaching bnxt_tls_snd_tag_alloc() only gated on BNXT_STATE_OPEN, which is set once by bnxt_open()/bnxt_attach_pre() but never cleared again, so it could not reject new sessions once bnxt_detach() started tearing things down. The snd_tag_alloc_ref-based wait in bnxt_detach(), which waits for in-flight allocators to exit, was already in place, but without this gate new sessions could keep being created for the entire duration of that wait, extending it indefinitely instead of just draining existing ones. Reject new sessions once softc->detached is set, and reset it back to false in bnxt_attach_pre() so it doesn't wrongly persist across a detach/reattach cycle. Reviewed by: gallatin Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58612 (cherry picked from commit a48a50919da5549b2a5a2141042087a25879435e) --- sys/dev/bnxt/bnxt_en/bnxt_ktls.c | 12 ++++++++++++ sys/dev/bnxt/bnxt_en/if_bnxt.c | 1 + 2 files changed, 13 insertions(+) diff --git a/sys/dev/bnxt/bnxt_en/bnxt_ktls.c b/sys/dev/bnxt/bnxt_en/bnxt_ktls.c index 0578de559910..90c59607f336 100644 --- a/sys/dev/bnxt/bnxt_en/bnxt_ktls.c +++ b/sys/dev/bnxt/bnxt_en/bnxt_ktls.c @@ -180,8 +180,20 @@ int bnxt_tls_snd_tag_alloc(if_t ifp, union if_snd_tag_alloc_params* params, if (!test_bit(BNXT_STATE_OPEN, &priv->state)) return (EPROTONOSUPPORT); + if (atomic_load_acq_int(&priv->detached)) + return (EPROTONOSUPPORT); + + /* + * Re-check `detached` after incrementing snd_tag_alloc_ref so + * bnxt_detach()'s drain loop can see this ref and wait for it. + */ atomic_add_32(&priv->ktls_info->snd_tag_alloc_ref, 1); + if (atomic_load_acq_int(&priv->detached)) { + atomic_subtract_32(&priv->ktls_info->snd_tag_alloc_ref, 1); + return (EPROTONOSUPPORT); + } + if (priv->ktls_info->init == 0) { counter_u64_add(ktls->err_counters[BNXT_KTLS_TX_UNINITIALIZED], 1); atomic_subtract_32(&priv->ktls_info->snd_tag_alloc_ref, 1); diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c index 56c562ea1b7f..61cbae29ecd2 100644 --- a/sys/dev/bnxt/bnxt_en/if_bnxt.c +++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c @@ -2682,6 +2682,7 @@ bnxt_attach_pre(if_ctx_t ctx) softc->slot = pci_get_slot(softc->dev); softc->function = pci_get_function(softc->dev); softc->dev_fn = PCI_DEVFN(softc->slot, softc->function); + atomic_store_rel_int(&softc->detached, 0); bnxt_set_flags_by_devid(softc);