Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville...
[firefly-linux-kernel-4.4.55.git] / net / mac80211 / wpa.c
index 9dc3b5f26e80c800a306aca5287b0e22fcda5378..d91c1a26630dc07a00ec22547e13ca7a02620f33 100644 (file)
@@ -154,7 +154,13 @@ update_iv:
        return RX_CONTINUE;
 
 mic_fail:
-       mac80211_ev_michael_mic_failure(rx->sdata, rx->key->conf.keyidx,
+       /*
+        * In some cases the key can be unset - e.g. a multicast packet, in
+        * a driver that supports HW encryption. Send up the key idx only if
+        * the key is set.
+        */
+       mac80211_ev_michael_mic_failure(rx->sdata,
+                                       rx->key ? rx->key->conf.keyidx : -1,
                                        (void *) skb->data, NULL, GFP_ATOMIC);
        return RX_DROP_UNUSABLE;
 }