diff options
author | Felix Fietkau <nbd@nbd.name> | 2018-05-15 14:33:23 +0200 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2018-05-23 10:56:48 +0300 |
commit | 66a77cbe63eb326513632cc88e1260e877be8123 (patch) | |
tree | a8849db392712b3d45be54eebc79f8ad90f80bd9 /drivers/net/wireless/mediatek | |
parent | d98fb328ad103d12c1ebaea92526e4f8670e0fec (diff) |
mt76: discard early received packets if not running yet
If the radio was previously in running state, it can receive some
packets before it is able to process them.
This can lead to a crash if the channel is not initialized yet.
Discard all rx packets until start() is called
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mediatek')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c index dab713756004..b49aea4da2d6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c @@ -301,6 +301,9 @@ int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb, u8 wcid; int len; + if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state)) + return -EINVAL; + if (rxinfo & MT_RXINFO_L2PAD) pad_len += 2; |