Fix a crash bug introduced in the iterate node work recently done.

When resuming, the first VAP is checked for max_aid; however if there
is no VAP, this results in a NULL pointer dereference and kernel
panic.
This commit is contained in:
Adrian Chadd 2012-09-16 22:45:00 +00:00
parent 9f668383b7
commit 7b5a343596
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240574

View File

@ -2245,8 +2245,16 @@ ieee80211_iterate_nodes(struct ieee80211_node_table *nt,
size_t size;
int i;
uint16_t max_aid;
struct ieee80211vap *vap;
/* Overdoing it default */
max_aid = IEEE80211_AID_MAX;
/* Handle the case of there being no vaps just yet */
vap = TAILQ_FIRST(&nt->nt_ic->ic_vaps);
if (vap != NULL)
max_aid = vap->iv_max_aid;
max_aid = TAILQ_FIRST(&nt->nt_ic->ic_vaps)->iv_max_aid;
size = max_aid * sizeof(struct ieee80211_node *);
ni_arr = (struct ieee80211_node **) malloc(size, M_80211_NODE,
M_NOWAIT | M_ZERO);