git: 509a185dd940 - main - net80211: fix bpf tap leak on wlan(4) detach

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Sat, 10 Jan 2026 18:56:54 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=509a185dd9405141df4d304d7805019b40e736cf

commit 509a185dd9405141df4d304d7805019b40e736cf
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-01-10 18:56:19 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-01-10 18:56:19 +0000

    net80211: fix bpf tap leak on wlan(4) detach
    
    PR:     292337
    Fixes:  8774a990ee4094f16d596d4b78e0f3239e5d0c88
---
 sys/net80211/ieee80211_radiotap.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/sys/net80211/ieee80211_radiotap.c b/sys/net80211/ieee80211_radiotap.c
index 4d36be6df9f5..aa1812045953 100644
--- a/sys/net80211/ieee80211_radiotap.c
+++ b/sys/net80211/ieee80211_radiotap.c
@@ -110,12 +110,6 @@ ieee80211_radiotap_detach(struct ieee80211com *ic)
 {
 }
 
-void
-ieee80211_radiotap_vdetach(struct ieee80211vap *vap)
-{
-	/* NB: bpfdetach is called by ether_ifdetach and claims all taps */
-}
-
 static void
 set_channel(void *p, const struct ieee80211_channel *c)
 {
@@ -472,3 +466,12 @@ ieee80211_radiotap_vattach(struct ieee80211vap *vap)
 		if_ref(vap->iv_ifp);
 	}
 }
+
+void
+ieee80211_radiotap_vdetach(struct ieee80211vap *vap)
+{
+	if (vap->iv_rawbpf != NULL) {
+		bpf_detach(vap->iv_rawbpf);
+		if_rele(vap->iv_ifp);
+	}
+}