Skip to content

Commit

Permalink
mt76x2: fix crash on monitor mode injection
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Jun 15, 2016
1 parent 810eef8 commit 11e0a12
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions mt76x2.h
Expand Up @@ -112,6 +112,7 @@ struct mt76x2_dev {

u32 aggr_stats[32];

struct mt76_wcid global_wcid;
struct mt76_wcid __rcu *wcid[254 - 8];

spinlock_t irq_lock;
Expand Down
3 changes: 2 additions & 1 deletion mt76x2_init.c
Expand Up @@ -547,7 +547,8 @@ int mt76x2_init_hardware(struct mt76x2_dev *dev)
(unsigned long) dev);

dev->chainmask = 0x202;

dev->global_wcid.idx = 255;
dev->global_wcid.hw_key_idx = -1;
dev->slottime = 9;

val = mt76_rr(dev, MT_WPDMA_GLO_CFG);
Expand Down
9 changes: 6 additions & 3 deletions mt76x2_tx.c
Expand Up @@ -26,13 +26,16 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct mt76x2_dev *dev = hw->priv;
struct ieee80211_vif *vif = info->control.vif;
struct mt76x2_vif *mvif = (struct mt76x2_vif *) vif->drv_priv;
struct mt76x2_sta *msta = NULL;
struct mt76_wcid *wcid = &mvif->group_wcid;
struct mt76_wcid *wcid = &dev->global_wcid;

if (control->sta) {
struct mt76x2_sta *msta;
msta = (struct mt76x2_sta *) control->sta->drv_priv;
wcid = &msta->wcid;
} else if (vif) {
struct mt76x2_vif *mvif;
mvif = (struct mt76x2_vif *) vif->drv_priv;
wcid = &mvif->group_wcid;
}

mt76_tx(&dev->mt76, control->sta, wcid, skb);
Expand Down

0 comments on commit 11e0a12

Please sign in to comment.