Commit f0dea9c7 authored by Arend van Spriel's avatar Arend van Spriel Committed by Johannes Berg

mac80211: check add_chanctx callback before use in ieee80211_reconfig

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: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent f4bda337
...@@ -1417,10 +1417,12 @@ int ieee80211_reconfig(struct ieee80211_local *local) ...@@ -1417,10 +1417,12 @@ int ieee80211_reconfig(struct ieee80211_local *local)
} }
/* add channel contexts */ /* add channel contexts */
mutex_lock(&local->chanctx_mtx); if (local->use_chanctx) {
list_for_each_entry(ctx, &local->chanctx_list, list) mutex_lock(&local->chanctx_mtx);
WARN_ON(drv_add_chanctx(local, ctx)); list_for_each_entry(ctx, &local->chanctx_list, list)
mutex_unlock(&local->chanctx_mtx); WARN_ON(drv_add_chanctx(local, ctx));
mutex_unlock(&local->chanctx_mtx);
}
list_for_each_entry(sdata, &local->interfaces, list) { list_for_each_entry(sdata, &local->interfaces, list) {
struct ieee80211_chanctx_conf *ctx_conf; struct ieee80211_chanctx_conf *ctx_conf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment