Date: Mon, 15 Apr 2024 17:40:36 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: cd9fee3d2c37 - main - net80211: amrr_init: change order of commands Message-ID: <202404151740.43FHea8K034569@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=cd9fee3d2c370e81109505c2abfd381af952e9b3 commit cd9fee3d2c370e81109505c2abfd381af952e9b3 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2024-02-05 14:48:08 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2024-04-15 17:32:28 +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. MFC after: 3 days Reviewed by: cc Differential Revision: https://reviews.freebsd.org/D43751 --- 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 */ }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404151740.43FHea8K034569>