ath10k: add extra sanity check when popping amsdu
authorMichal Kazior <michal.kazior@tieto.com>
Thu, 23 Oct 2014 14:04:24 +0000 (17:04 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Fri, 24 Oct 2014 13:29:19 +0000 (16:29 +0300)
The netbuf pop can return NULL. Make sure to check
for that. It shouldn't happen but better safe than
sorry.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/htt_rx.c

index 7fa4d872f05cd2b6fdf3c19efc5573253a232120..25bd286391d91876dd36b827c7e95f1488de0ab6 100644 (file)
@@ -428,6 +428,15 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
                while (msdu_chained--) {
                        struct sk_buff *next = ath10k_htt_rx_netbuf_pop(htt);
 
+                       if (!next) {
+                               ath10k_warn(ar, "failed to pop chained msdu\n");
+                               ath10k_htt_rx_free_msdu_chain(*head_msdu);
+                               *head_msdu = NULL;
+                               msdu = NULL;
+                               htt->rx_confused = true;
+                               break;
+                       }
+
                        skb_trim(next, 0);
                        skb_put(next, min(msdu_len, HTT_RX_BUF_SIZE));
                        msdu_len -= next->len;