From nobody Sun Mar 8 17:07:33 2026 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 4fTRQs3rdPz6TSmp for ; Sun, 08 Mar 2026 17:07:33 +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" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fTRQs38F9z3vd5 for ; Sun, 08 Mar 2026 17:07:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772989653; 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=dKdUzirvCzxUz/LDe+IgzGcABACxRXbuDEl5l4OkrvY=; b=tJ1TOaR4vX9LoFCqFNFFT/PoMVfv1VupDJTY5VtCkP5fPrRrtzJu7FU0b6UK/p+KFUOMFZ uwSP+4gkpfIPaoboX7wTKooxHuEeqQ7en58rXi/GKyUSU2mfDFpORdVaNyggdDc0OPeDjK WQKBvwsLioC/x8Pd/ZVVkhv6feZyQknBmbbb0ihjxWizY1B+nSDY6SPOUqOtkArK90uXKf +HVo7Xbn3jeGQgrD+iB2bp5lZPHjWJTk0q2ST5txsLIPgsg+fLJztOIfs9vkujiynDZtIW dEy7MfpCAUyWmgc31FbU67XAHShQFRUzyiqeHKsbWm2357EOgm7FXCV1xXE7WQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772989653; a=rsa-sha256; cv=none; b=ckoDrZ1gXwUJMrxHlG9WwrmwnsGMM2088x/G2PUSCHOP5iitrAyVHqIPKNb092Eb3BfTi5 XM6+kyrSnYbMj1E7kjedVoDL7OiIuF5Pu2OR9bolXe7u0wdhbOZwFQbtV95QOq/tN08wCh njnCMMwfYumO2IxzvyeT2I/6Xi05nGlvScSHtC6tTxYxdXFGwRFkEKizIKI6QnhtWv6WYn Wojulvhwty31UT03Zc0ETTGXaBfOHXPLmM3Paq7VkU8BKy9paqnSQtBWRaE5oHIKe/iNI1 umhO1T5O8rKYL3NBy+TZmy2ywKutMRnG1/1/jre1KsyYFMV7Ki1+W/nPwTmjIQ== 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=1772989653; 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=dKdUzirvCzxUz/LDe+IgzGcABACxRXbuDEl5l4OkrvY=; b=blHz2jtmWAAk3kIPk53tvIXsXPhpcF2fv8gTS8JavHSbgdL6Twtvlq4pD5ZkgovWzkqSi3 Ob926CRvGx9p/DaRyeiw9Fnad7gDQDtkmJ3gKDE3mZUe8pBKC1sSsdNh698Zo1gLCWPwtq 7DQZgGm+U1EG2Htm9O/bH1Rk8iYV03zQ8n9wDVtqPljqZcciGYyhJkH0etXD3Brcow4LEF C4PBs/10xEu/opQFRYC6Os+C3/PHtnsCbQjZtcRZXWUmpL+l7m8Y8KANSeth+01T7E0Gvj hEdz1pNzZI3ThxjOILWSuUONkW9s0FIslYxStyBzlxX4UAkp1KQIuBpEDVLrzw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fTRQs2gvrz141Z for ; Sun, 08 Mar 2026 17:07:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 433ce by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 08 Mar 2026 17:07:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 53c69fd933dc - main - LinuxKPI: 802.11: lkpi_sta_auth_to_scan() fail graciously on lsta == NULL 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53c69fd933dc49f69d5603fb27ce51064ebe681e Auto-Submitted: auto-generated Date: Sun, 08 Mar 2026 17:07:33 +0000 Message-Id: <69adacd5.433ce.68a3fd9c@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=53c69fd933dc49f69d5603fb27ce51064ebe681e commit 53c69fd933dc49f69d5603fb27ce51064ebe681e Author: Bjoern A. Zeeb AuthorDate: 2026-03-08 12:48:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-03-08 13:49:52 +0000 LinuxKPI: 802.11: lkpi_sta_auth_to_scan() fail graciously on lsta == NULL Usually after a firmware crash, we see reports of crashes in lkpi_sta_auth_to_scan(). One of the last ones was in the PR mentioned below. These crashes are often attributed as the problem while the real problem happened before. At this point try avoid the NULL pointer and to fail graciously if lvif->iv_bss (lsta) is no longer set. This way users have a chance to possibly recover using netif restart wlan0 rather than dealing with a panic. See if this helps us to better track down the original problems rather than the follow-up crash. On a debug kernel the KASSERT should normally have caught that condition as well but we see panics on page faults were the log line was there but then the lsta->ni deref has happened, which is after the KASSERT. I have not checked if this is a reordering problem or if the people reporting had IEEE80211_DEBUG on but not INVARIANTS. Sponsored by: The FreeBSD Foundation PR: 286219 #c11 MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 63f92b8afb2b..01347586ef63 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -3215,16 +3215,28 @@ lkpi_sta_auth_to_scan(struct ieee80211vap *vap, enum ieee80211_state nstate, int wiphy_lock(hw->wiphy); LKPI_80211_LVIF_LOCK(lvif); -#ifdef LINUXKPI_DEBUG_80211 - /* XXX-BZ KASSERT later; state going down so no action. */ - if (lvif->lvif_bss == NULL) - ic_printf(vap->iv_ic, "%s:%d: lvif %p vap %p iv_bss %p lvif_bss %p " - "lvif_bss->ni %p synched %d\n", __func__, __LINE__, + /* + * XXX-BZ KASSERT later; state going down so no action in theory + * but try to avoid a NULL-pointer derref for now and gracefully + * fail for non-debug kernels. + */ + if (lvif->lvif_bss == NULL) { + ic_printf(vap->iv_ic, "%s:%d: ERROR: lvif %p vap %p iv_bss %p " + "lvif_bss %p lvif_bss->ni %p synched %d; " + "expect follow-up problems\n", __func__, __LINE__, lvif, vap, vap->iv_bss, lvif->lvif_bss, (lvif->lvif_bss != NULL) ? lvif->lvif_bss->ni : NULL, lvif->lvif_bss_synched); -#endif - + LKPI_80211_LVIF_UNLOCK(lvif); + /* + * This will likely lead to a firmware crash (if there + * was not one before already) and need a + * ieee80211_restart_hw() but still better than a panic + * for users as they can at least recover. + */ + error = ENOTRECOVERABLE; + goto out; + } lsta = lvif->lvif_bss; LKPI_80211_LVIF_UNLOCK(lvif); KASSERT(lsta != NULL && lsta->ni != NULL, ("%s: lsta %p ni %p "