@@ -121,12 +121,39 @@ static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
121
121
struct iwl_rx_mpdu_desc * desc = (void * )pkt -> data ;
122
122
unsigned int headlen , fraglen , pad_len = 0 ;
123
123
unsigned int hdrlen = ieee80211_hdrlen (hdr -> frame_control );
124
+ u8 mic_crc_len = u8_get_bits (desc -> mac_flags1 ,
125
+ IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK ) << 1 ;
124
126
125
127
if (desc -> mac_flags2 & IWL_RX_MPDU_MFLG2_PAD ) {
126
128
len -= 2 ;
127
129
pad_len = 2 ;
128
130
}
129
131
132
+ /*
133
+ * For non monitor interface strip the bytes the RADA might not have
134
+ * removed. As monitor interface cannot exist with other interfaces
135
+ * this removal is safe.
136
+ */
137
+ if (mic_crc_len && !ieee80211_hw_check (mvm -> hw , RX_INCLUDES_FCS )) {
138
+ u32 pkt_flags = le32_to_cpu (pkt -> len_n_flags );
139
+
140
+ /*
141
+ * If RADA was not enabled then decryption was not performed so
142
+ * the MIC cannot be removed.
143
+ */
144
+ if (!(pkt_flags & FH_RSCSR_RADA_EN )) {
145
+ if (WARN_ON (crypt_len > mic_crc_len ))
146
+ return - EINVAL ;
147
+
148
+ mic_crc_len -= crypt_len ;
149
+ }
150
+
151
+ if (WARN_ON (mic_crc_len > len ))
152
+ return - EINVAL ;
153
+
154
+ len -= mic_crc_len ;
155
+ }
156
+
130
157
/* If frame is small enough to fit in skb->head, pull it completely.
131
158
* If not, only pull ieee80211_hdr (including crypto if present, and
132
159
* an additional 8 bytes for SNAP/ethertype, see below) so that
0 commit comments