From owner-svn-src-stable@freebsd.org Sun Jul 30 18:29:29 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58CE6DBFE8E; Sun, 30 Jul 2017 18:29:29 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B39E7CCB2; Sun, 30 Jul 2017 18:29:29 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6UITSwd081376; Sun, 30 Jul 2017 18:29:28 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6UITS4R081374; Sun, 30 Jul 2017 18:29:28 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201707301829.v6UITS4R081374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 30 Jul 2017 18:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r321724 - stable/11/sys/net80211 X-SVN-Group: stable-11 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/11/sys/net80211 X-SVN-Commit-Revision: 321724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2017 18:29:29 -0000 Author: avos Date: Sun Jul 30 18:29:28 2017 New Revision: 321724 URL: https://svnweb.freebsd.org/changeset/base/321724 Log: MFC r321401: 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. Modified: stable/11/sys/net80211/ieee80211_amrr.c stable/11/sys/net80211/ieee80211_rssadapt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net80211/ieee80211_amrr.c ============================================================================== --- stable/11/sys/net80211/ieee80211_amrr.c Sun Jul 30 18:01:34 2017 (r321723) +++ stable/11/sys/net80211/ieee80211_amrr.c Sun Jul 30 18:29:28 2017 (r321724) @@ -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 */ } /* Modified: stable/11/sys/net80211/ieee80211_rssadapt.c ============================================================================== --- stable/11/sys/net80211/ieee80211_rssadapt.c Sun Jul 30 18:01:34 2017 (r321723) +++ stable/11/sys/net80211/ieee80211_rssadapt.c Sun Jul 30 18:29:28 2017 (r321724) @@ -131,7 +131,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) { @@ -147,6 +148,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