From 73edb22822e7d60d1021efd43fe72a1886c0dcab Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 15 May 2018 14:28:22 +0200 Subject: [PATCH] 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 --- mt76x2_mac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mt76x2_mac.c b/mt76x2_mac.c index 85d1bd8bb..8ddc03b89 100644 --- a/mt76x2_mac.c +++ b/mt76x2_mac.c @@ -314,6 +314,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;