]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
mt76: fix possible NULL pointer dereferencing in mt76x2_ampdu_action()
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Thu, 14 Dec 2017 12:03:16 +0000 (13:03 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 17 Jan 2018 14:49:06 +0000 (16:49 +0200)
Initialize mt76_txq pointer after ieee80211_txq pointer check.
Remove space after the pointer cast

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mediatek/mt76/mt76x2_main.c

index 963aea9e8801eeffee13d279247ef4ed634fa3d5..79915cbee3f04103cca812cb154e1741ff76bf88 100644 (file)
@@ -465,13 +465,15 @@ mt76x2_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        struct mt76x2_dev *dev = hw->priv;
        struct mt76x2_sta *msta = (struct mt76x2_sta *) sta->drv_priv;
        struct ieee80211_txq *txq = sta->txq[params->tid];
-       struct mt76_txq *mtxq = (struct mt76_txq *) txq->drv_priv;
        u16 tid = params->tid;
        u16 *ssn = &params->ssn;
+       struct mt76_txq *mtxq;
 
        if (!txq)
                return -EINVAL;
 
+       mtxq = (struct mt76_txq *)txq->drv_priv;
+
        switch (action) {
        case IEEE80211_AMPDU_RX_START:
                mt76_set(dev, MT_WCID_ADDR(msta->wcid.idx) + 4, BIT(16 + tid));