From: Johannes Berg johannes.berg@intel.com
During the transition to use channel contexts throughout, the ability to do injection while in monitor mode concurrent with another interface was lost, since the (virtual) monitor won't have a chanctx assigned in this scenario.
We could use the local->hw.conf.chandef in the emulation case, but that wouldn't fix drivers (such as mt76) that themselves are now using channel contexts.
So instead, assume that if there's just a single chanctx that must be the one meant for injection, addressing both cases.
Cc: stable@vger.kernel.org Link: https://bugzilla.kernel.org/show_bug.cgi?id=218763 Reported-by: Oscar Alfonso Diaz oscar.alfonso.diaz@gmail.com Fixes: 0a44dfc07074 ("wifi: mac80211: simplify non-chanctx drivers") Signed-off-by: Johannes Berg johannes.berg@intel.com --- v2: use the single chanctx if such a thing exists to fix both cases of emulation and drivers that changed like mt76 --- net/mac80211/tx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 9d8b0a25f73c..22d0df442ac0 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2395,6 +2395,18 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, rcu_dereference(tmp_sdata->vif.bss_conf.chanctx_conf); }
+ if (!chanctx_conf) { + struct ieee80211_chanctx *ctx; + bool first = true; + + list_for_each_entry_rcu(ctx, &local->chanctx_list, list) { + if (!first) + goto fail_rcu; + chanctx_conf = &ctx->conf; + first = false; + } + } + if (chanctx_conf) chandef = &chanctx_conf->def; else
linux-stable-mirror@lists.linaro.org