net80211: do not allow to unload rate control module if it is still in use.
Keep 'nrefs' counter up-to-date, so 'kldunload wlan_amrr' with 1+ active wlan(4) interface will not lead to kernel panic. MFC after: 5 days
This commit is contained in:
parent
f1b21e2c92
commit
810490a0e2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=321401
@ -117,6 +117,7 @@ amrr_init(struct ieee80211vap *vap)
|
||||
|
||||
KASSERT(vap->iv_rs == NULL, ("%s called multiple times", __func__));
|
||||
|
||||
nrefs++; /* XXX locking */
|
||||
amrr = vap->iv_rs = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr),
|
||||
M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
|
||||
if (amrr == NULL) {
|
||||
@ -133,6 +134,8 @@ static void
|
||||
amrr_deinit(struct ieee80211vap *vap)
|
||||
{
|
||||
IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL);
|
||||
KASSERT(nrefs > 0, ("imbalanced attach/detach"));
|
||||
nrefs--; /* XXX locking */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -130,7 +130,8 @@ rssadapt_init(struct ieee80211vap *vap)
|
||||
|
||||
KASSERT(vap->iv_rs == NULL, ("%s: iv_rs already initialized",
|
||||
__func__));
|
||||
|
||||
|
||||
nrefs++; /* XXX locking */
|
||||
vap->iv_rs = rs = IEEE80211_MALLOC(sizeof(struct ieee80211_rssadapt),
|
||||
M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
|
||||
if (rs == NULL) {
|
||||
@ -146,6 +147,8 @@ static void
|
||||
rssadapt_deinit(struct ieee80211vap *vap)
|
||||
{
|
||||
IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL);
|
||||
KASSERT(nrefs > 0, ("imbalanced attach/detach"));
|
||||
nrefs--; /* XXX locking */
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user