2013-01-13 22:10:28

by Felix Fietkau

[permalink] [raw]
Subject: [PATCH] mac80211: fix monitor mode injection

Channel contexts are not always used with monitor interfaces. If no channel
context is set, use the oper channel, otherwise tx fails.

Signed-off-by: Felix Fietkau <[email protected]>
---
net/mac80211/tx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index e9eadc4..8010879 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1673,10 +1673,10 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
chanctx_conf =
rcu_dereference(tmp_sdata->vif.chanctx_conf);
}
- if (!chanctx_conf)
- goto fail_rcu;
-
- chan = chanctx_conf->def.chan;
+ if (chanctx_conf)
+ chan = chanctx_conf->def.chan;
+ else
+ chan = local->_oper_channel;

/*
* Frame injection is not allowed if beaconing is not allowed
--
1.8.0.2



2013-01-16 14:09:20

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: fix monitor mode injection

On Sun, 2013-01-13 at 23:10 +0100, Felix Fietkau wrote:
> Channel contexts are not always used with monitor interfaces. If no channel
> context is set, use the oper channel, otherwise tx fails.

Applied, but I also added a check for local->use_chanctx.

johannes