Skip to content

Commit

Permalink
mac80211: check add_chanctx callback before use in ieee80211_reconfig
Browse files Browse the repository at this point in the history
During testing our mac80211 driver a fatal error occurred which was
signalled to mac80211. Upon performing the reconfiguration of the
device a WARN_ON was triggered. This warning checked the return value
of drv_add_chanctx(). However, this returns -EOPNOTSUPP when the
driver does not provide the callback. As the callback is optional
better check it is defined before calling drv_add_chanctx().

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Arend van Spriel authored and Johannes Berg committed Nov 19, 2012
1 parent f4bda33 commit f0dea9c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions net/mac80211/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,10 +1417,12 @@ int ieee80211_reconfig(struct ieee80211_local *local)
}

/* add channel contexts */
mutex_lock(&local->chanctx_mtx);
list_for_each_entry(ctx, &local->chanctx_list, list)
WARN_ON(drv_add_chanctx(local, ctx));
mutex_unlock(&local->chanctx_mtx);
if (local->use_chanctx) {
mutex_lock(&local->chanctx_mtx);
list_for_each_entry(ctx, &local->chanctx_list, list)
WARN_ON(drv_add_chanctx(local, ctx));
mutex_unlock(&local->chanctx_mtx);
}

list_for_each_entry(sdata, &local->interfaces, list) {
struct ieee80211_chanctx_conf *ctx_conf;
Expand Down

0 comments on commit f0dea9c

Please sign in to comment.