Commit 5bbe754d9ecc4a09994ecd0cf3b167224e114da5

Authored by Johannes Berg
1 parent 89afe614c0

mac80211: don't call bss_info_changed on p2p-device/monitor

Since the idle decision rework, mac80211 started calling
bss_info_changed() for the driver's monitor interface,
which causes a crash for iwlwifi, but drivers generally
don't expect this to happen. Therefore, avoid it.

While at it, also prevent calling it in such cases and
only print a warning. For the P2P Device interface the
idle will no longer be called (no channel context), so
also prevent that and warn on it.

Reported-by: Chaitanya <chaitanya.mgit@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Showing 2 changed files with 18 additions and 9 deletions Side-by-side Diff

... ... @@ -137,8 +137,11 @@
137 137  
138 138 ieee80211_recalc_txpower(sdata);
139 139 sdata->vif.bss_conf.idle = false;
140   - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IDLE);
141 140  
  141 + if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
  142 + sdata->vif.type != NL80211_IFTYPE_MONITOR)
  143 + ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IDLE);
  144 +
142 145 return 0;
143 146 }
144 147  
... ... @@ -186,7 +189,10 @@
186 189 rcu_assign_pointer(sdata->vif.chanctx_conf, NULL);
187 190  
188 191 sdata->vif.bss_conf.idle = true;
189   - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IDLE);
  192 +
  193 + if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
  194 + sdata->vif.type != NL80211_IFTYPE_MONITOR)
  195 + ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IDLE);
190 196  
191 197 drv_unassign_vif_chanctx(local, sdata, ctx);
192 198  
net/mac80211/driver-ops.h
... ... @@ -207,13 +207,16 @@
207 207 {
208 208 might_sleep();
209 209  
210   - WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON |
211   - BSS_CHANGED_BEACON_ENABLED) &&
212   - sdata->vif.type != NL80211_IFTYPE_AP &&
213   - sdata->vif.type != NL80211_IFTYPE_ADHOC &&
214   - sdata->vif.type != NL80211_IFTYPE_MESH_POINT);
215   - WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE &&
216   - changed & ~BSS_CHANGED_IDLE);
  210 + if (WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON |
  211 + BSS_CHANGED_BEACON_ENABLED) &&
  212 + sdata->vif.type != NL80211_IFTYPE_AP &&
  213 + sdata->vif.type != NL80211_IFTYPE_ADHOC &&
  214 + sdata->vif.type != NL80211_IFTYPE_MESH_POINT))
  215 + return;
  216 +
  217 + if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE ||
  218 + sdata->vif.type == NL80211_IFTYPE_MONITOR))
  219 + return;
217 220  
218 221 check_sdata_in_driver(sdata);
219 222