From 31e9bdb1afbf382f367046b86fb6e85e43d950c0 Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi Date: Fri, 15 Dec 2017 15:30:04 +0100 Subject: [PATCH] mt7603: main: fix possible NULL pointer dereferencing in mt7603_ampdu_action() Initialize mt76_txq pointer after ieee80211_txq pointer check. Remove space after the pointer cast Signed-off-by: Lorenzo Bianconi --- mt7603_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mt7603_main.c b/mt7603_main.c index dc766f50..c83efd1b 100644 --- a/mt7603_main.c +++ b/mt7603_main.c @@ -456,14 +456,16 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta = params->sta; struct ieee80211_txq *txq = sta->txq[params->tid]; struct mt7603_sta *msta = (struct mt7603_sta *) sta->drv_priv; - struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv; u16 tid = params->tid; u16 *ssn = ¶ms->ssn; u8 ba_size = params->buf_size; + struct mt76_txq *mtxq; if (!txq) return -EINVAL; + mtxq = (struct mt76_txq *)txq->drv_priv; + switch (action) { case IEEE80211_AMPDU_RX_START: mt7603_mac_rx_ba_reset(dev, sta->addr, tid);