From nobody Mon Apr 22 19:44:05 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 4VNbKd4tFqz5Hm3m; Mon, 22 Apr 2024 19:44:05 +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 4VNbKd3Kmfz4mh0; Mon, 22 Apr 2024 19:44:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713815045; 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=7wwWFLsJAAsLkW6yyrKAk7/IYx1Wo9so//WHtzSMoZY=; b=KPZLNssj8mZTf0qa03NJDwrsVpnSBCIwSP6ztY34UheEY4lkpqFnWgoOlzs3dD/Lj837mo XOBX0YcMv2qg5ihoGzkibOU+KcYb06gv0I9adA81jPw5UYTaqVUO32gQeR5I8q76pdc80V za6h6pRjSisp/JnWg768cca0MVDDl5arHvu8Cupm+eFep9Uh/0MPp4KSVgX4TQVdohZz3/ qoyFoaIfzwTANLSfhYGNyEdM6UC6H4/05x8jN23g78qpXu7p9b5bSgeOtUO3x+sV0Uw7u1 qSpJkUCZ/MAahGFTlGU/l5KkgyM5Iv4euoX9cGhmiejfT1m4idSnF0v1ebmgqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713815045; a=rsa-sha256; cv=none; b=yPpoegbh7tyC+YAbCdFkmZBXZ1eZrih1TkMipoYYyGWgCugSQovfndngctuqM0qVx6Lk72 4KQFgCVugag03q5TDYYsCTA7cQc0QQojcLa7uGEInibwt8SNc8NdhMwzWnmVgzryuLP4qs x5XFq7QoPLNGGdSGAN8LtrabkUFigfmnnCiFZzq8psagJ3Hy6aDjL69eIL+W4YvjaP71RY /7l7NRn5/oaOeARDvo2T12FOWgAtZJ1YI+cTbsdTQbDLt/PiLu33JtBcihdmMAt+YRbuYT 2SgwKVe4Rv5YGXgPvGYOcExvDtaVq3MZuN7HRrlgvGCSldauQH4wXEKAJ8taMQ== 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=1713815045; 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=7wwWFLsJAAsLkW6yyrKAk7/IYx1Wo9so//WHtzSMoZY=; b=wmNZBaZqx2ujWhioFXDZCczklfEvx0Qz7ehByLL2NWI73SdjHohllmqUbzWRxS+DMoLvBf 4MqBD0fa3321BlkBgmWeXixNx21VKVWSFTmubjx0lcWRRNdShLE9h6gTS4lFW7gVP37ej9 ssyjgZmjmbPgnHDVKHTpVqSCZoWT3Oi8noyLvhOdKRiQ8njX24+vGh1aB7xuQ5T3QDvWvd L4klCELjGZfSZFMovXlKtAY8W5ZqGaQhicfjdVW9zW1wWRd5ca9ctfPjtEssXTMQWlotRu z/uOC42Kc7BYIHZcYG1pFeo8jG3Whyiwtn7sVbIlVVaVHOmU7g0ss7GRTP8XsA== 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 4VNbKd1t2qz11RK; Mon, 22 Apr 2024 19:44:05 +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 43MJi55J032371; Mon, 22 Apr 2024 19:44:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43MJi58d032368; Mon, 22 Apr 2024 19:44:05 GMT (envelope-from git) Date: Mon, 22 Apr 2024 19:44:05 GMT Message-Id: <202404221944.43MJi58d032368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 634fd711b003 - stable/14 - net80211: amrr_init: change order of commands 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: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 634fd711b003fa59fda39533a2b578228299031a Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=634fd711b003fa59fda39533a2b578228299031a commit 634fd711b003fa59fda39533a2b578228299031a Author: Bjoern A. Zeeb AuthorDate: 2024-02-05 14:48:08 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-04-22 17:00:22 +0000 net80211: amrr_init: change order of commands First run the KASSERT before trying to do the free operation. Better for reporting and debugging. Add a guard setting the value to NULL afterwards. NULL pointers are a lot easier to test for. Reviewed by: cc Differential Revision: https://reviews.freebsd.org/D43751 (cherry picked from commit cd9fee3d2c370e81109505c2abfd381af952e9b3) --- sys/net80211/ieee80211_amrr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c index 7248af0edccf..461554d75ea1 100644 --- a/sys/net80211/ieee80211_amrr.c +++ b/sys/net80211/ieee80211_amrr.c @@ -132,8 +132,9 @@ amrr_init(struct ieee80211vap *vap) static void amrr_deinit(struct ieee80211vap *vap) { - IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); KASSERT(nrefs > 0, ("imbalanced attach/detach")); + IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); + vap->iv_rs = NULL; /* guard */ nrefs--; /* XXX locking */ }