Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Nov 2010 12:22:02 +0000 (UTC)
From:      Bernhard Schmidt <bschmidt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r215556 - stable/8/sys/net80211
Message-ID:  <201011201222.oAKCM2gp011431@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bschmidt
Date: Sat Nov 20 12:22:02 2010
New Revision: 215556
URL: http://svn.freebsd.org/changeset/base/215556

Log:
  MFC r207323:
  When in the RUN -> AUTH -> RUN FSM transition happens, we'll call the
  ratectl_node_init() functions and since ni_rtctls was already malloc'ed()
  we will panic. Fix this by using the already malloc'ed pointer.

Modified:
  stable/8/sys/net80211/ieee80211_amrr.c
  stable/8/sys/net80211/ieee80211_rssadapt.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/net80211/ieee80211_amrr.c
==============================================================================
--- stable/8/sys/net80211/ieee80211_amrr.c	Sat Nov 20 11:14:06 2010	(r215555)
+++ stable/8/sys/net80211/ieee80211_amrr.c	Sat Nov 20 12:22:02 2010	(r215556)
@@ -136,16 +136,16 @@ amrr_node_init(struct ieee80211_node *ni
 	struct ieee80211_amrr *amrr = vap->iv_rs;
 	struct ieee80211_amrr_node *amn;
 
-	KASSERT(ni->ni_rctls == NULL, ("%s: ni_rctls already initialized",
-	    __func__));
-
-	ni->ni_rctls = amn = malloc(sizeof(struct ieee80211_amrr_node),
-	    M_80211_RATECTL, M_NOWAIT|M_ZERO);
-	if (amn == NULL) {
-		if_printf(vap->iv_ifp, "couldn't alloc per-node ratectl "
-		    "structure\n");
-		return;
-	}
+	if (ni->ni_rctls == NULL) {
+		ni->ni_rctls = amn = malloc(sizeof(struct ieee80211_amrr_node),
+		    M_80211_RATECTL, M_NOWAIT|M_ZERO);
+		if (amn == NULL) {
+			if_printf(vap->iv_ifp, "couldn't alloc per-node ratectl "
+			    "structure\n");
+			return;
+		}
+	} else
+		amn = ni->ni_rctls;
 	amn->amn_amrr = amrr;
 	amn->amn_success = 0;
 	amn->amn_recovery = 0;

Modified: stable/8/sys/net80211/ieee80211_rssadapt.c
==============================================================================
--- stable/8/sys/net80211/ieee80211_rssadapt.c	Sat Nov 20 11:14:06 2010	(r215555)
+++ stable/8/sys/net80211/ieee80211_rssadapt.c	Sat Nov 20 12:22:02 2010	(r215556)
@@ -169,13 +169,17 @@ rssadapt_node_init(struct ieee80211_node
 	struct ieee80211_rssadapt *rsa = vap->iv_rs;
 	const struct ieee80211_rateset *rs = &ni->ni_rates;
 
-	ni->ni_rctls = ra = malloc(sizeof(struct ieee80211_rssadapt_node),
-	    M_80211_RATECTL, M_NOWAIT|M_ZERO);
-	if (ra == NULL) {
-		if_printf(vap->iv_ifp, "couldn't alloc per-node ratectl "
-		    "structure\n");
-		return;
-	}
+	if (ni->ni_rctls == NULL) {
+		ni->ni_rctls = ra = 
+		    malloc(sizeof(struct ieee80211_rssadapt_node),
+		        M_80211_RATECTL, M_NOWAIT|M_ZERO);
+		if (ra == NULL) {
+			if_printf(vap->iv_ifp, "couldn't alloc per-node ratectl "
+			    "structure\n");
+			return;
+		}
+	} else
+		ra = ni->ni_rctls;
 	ra->ra_rs = rsa;
 	ra->ra_rates = *rs;
 	rssadapt_updatestats(ra);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011201222.oAKCM2gp011431>