Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rtlwifi / rtl8723ae / trx.c
index ac081297db50ddd454bbaa9963bddbfce487b653..6c64365308d3780f1bd84e1f6c4dcb5177fb9be1 100644 (file)
@@ -307,9 +307,6 @@ bool rtl8723ae_rx_query_desc(struct ieee80211_hw *hw,
        rx_status->freq = hw->conf.channel->center_freq;
        rx_status->band = hw->conf.channel->band;
 
-       hdr = (struct ieee80211_hdr *)(skb->data + status->rx_drvinfo_size
-               + status->rx_bufshift);
-
        if (status->crc)
                rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
 
@@ -330,6 +327,13 @@ bool rtl8723ae_rx_query_desc(struct ieee80211_hw *hw,
         * to decrypt it
         */
        if (status->decrypted) {
+               hdr = (struct ieee80211_hdr *)(skb->data +
+                      status->rx_drvinfo_size + status->rx_bufshift);
+
+               if (!hdr) {
+                       /* during testing, hdr could be NULL here */
+                       return false;
+               }
                if ((ieee80211_is_robust_mgmt_frame(hdr)) &&
                        (ieee80211_has_protected(hdr->frame_control)))
                        rx_status->flag &= ~RX_FLAG_DECRYPTED;