ath10k: fix potential null dereference bugs
[cascardo/linux.git] / drivers / net / wireless / ath / ath10k / mac.c
index 3a170b1..3560ae9 100644 (file)
@@ -3675,17 +3675,18 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work)
 
 static void ath10k_mac_txq_init(struct ieee80211_txq *txq)
 {
-       struct ath10k_txq *artxq = (void *)txq->drv_priv;
+       struct ath10k_txq *artxq;
 
        if (!txq)
                return;
 
+       artxq = (void *)txq->drv_priv;
        INIT_LIST_HEAD(&artxq->list);
 }
 
 static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq)
 {
-       struct ath10k_txq *artxq = (void *)txq->drv_priv;
+       struct ath10k_txq *artxq;
        struct ath10k_skb_cb *cb;
        struct sk_buff *msdu;
        int msdu_id;
@@ -3693,6 +3694,7 @@ static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq)
        if (!txq)
                return;
 
+       artxq = (void *)txq->drv_priv;
        spin_lock_bh(&ar->txqs_lock);
        if (!list_empty(&artxq->list))
                list_del_init(&artxq->list);