mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
mt76: do not pass the received frame with decryption error
[ Upstream commit dd28dea52a ]
MAC80211 doesn't care any decryption error in 802.3 path, so received
frame will be dropped if HW tell us that the cipher configuration is not
matched as well as the header has been translated to 802.3. This case only
appears when IEEE80211_FCTL_PROTECTED is 0 and cipher suit is not none in
the corresponding HW entry.
The received frame is only reported to monitor interface if HW decryption
block tell us there is ICV error or CCMP/BIP/WPI MIC error. Note in this
case the reported frame is decrypted 802.11 frame and the payload may be
malformed due to mismatched key.
Signed-off-by: Xing Song <xing.song@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3a1ef2b123
commit
9d39145c49
@@ -525,6 +525,10 @@ mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_buff *skb)
|
||||
if (rxd2 & MT_RXD2_NORMAL_TKIP_MIC_ERR)
|
||||
status->flag |= RX_FLAG_MMIC_ERROR;
|
||||
|
||||
/* ICV error or CCMP/BIP/WPI MIC error */
|
||||
if (rxd2 & MT_RXD2_NORMAL_ICV_ERR)
|
||||
status->flag |= RX_FLAG_ONLY_MONITOR;
|
||||
|
||||
if (FIELD_GET(MT_RXD2_NORMAL_SEC_MODE, rxd2) != 0 &&
|
||||
!(rxd2 & (MT_RXD2_NORMAL_CLM | MT_RXD2_NORMAL_CM))) {
|
||||
status->flag |= RX_FLAG_DECRYPTED;
|
||||
|
||||
@@ -286,9 +286,16 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb)
|
||||
if (rxd2 & MT_RXD2_NORMAL_AMSDU_ERR)
|
||||
return -EINVAL;
|
||||
|
||||
hdr_trans = rxd1 & MT_RXD1_NORMAL_HDR_TRANS;
|
||||
if (hdr_trans && (rxd2 & MT_RXD2_NORMAL_CM))
|
||||
return -EINVAL;
|
||||
|
||||
/* ICV error or CCMP/BIP/WPI MIC error */
|
||||
if (rxd2 & MT_RXD2_NORMAL_ICV_ERR)
|
||||
status->flag |= RX_FLAG_ONLY_MONITOR;
|
||||
|
||||
unicast = (rxd1 & MT_RXD1_NORMAL_ADDR_TYPE) == MT_RXD1_NORMAL_U2M;
|
||||
idx = FIELD_GET(MT_RXD2_NORMAL_WLAN_IDX, rxd2);
|
||||
hdr_trans = rxd1 & MT_RXD1_NORMAL_HDR_TRANS;
|
||||
status->wcid = mt7615_rx_get_wcid(dev, idx, unicast);
|
||||
|
||||
if (status->wcid) {
|
||||
|
||||
@@ -349,9 +349,16 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb)
|
||||
if (rxd2 & MT_RXD2_NORMAL_AMSDU_ERR)
|
||||
return -EINVAL;
|
||||
|
||||
hdr_trans = rxd2 & MT_RXD2_NORMAL_HDR_TRANS;
|
||||
if (hdr_trans && (rxd1 & MT_RXD1_NORMAL_CM))
|
||||
return -EINVAL;
|
||||
|
||||
/* ICV error or CCMP/BIP/WPI MIC error */
|
||||
if (rxd1 & MT_RXD1_NORMAL_ICV_ERR)
|
||||
status->flag |= RX_FLAG_ONLY_MONITOR;
|
||||
|
||||
unicast = FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) == MT_RXD3_NORMAL_U2M;
|
||||
idx = FIELD_GET(MT_RXD1_NORMAL_WLAN_IDX, rxd1);
|
||||
hdr_trans = rxd2 & MT_RXD2_NORMAL_HDR_TRANS;
|
||||
status->wcid = mt7915_rx_get_wcid(dev, idx, unicast);
|
||||
|
||||
if (status->wcid) {
|
||||
|
||||
@@ -383,10 +383,17 @@ int mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
|
||||
if (rxd2 & MT_RXD2_NORMAL_AMSDU_ERR)
|
||||
return -EINVAL;
|
||||
|
||||
hdr_trans = rxd2 & MT_RXD2_NORMAL_HDR_TRANS;
|
||||
if (hdr_trans && (rxd1 & MT_RXD1_NORMAL_CM))
|
||||
return -EINVAL;
|
||||
|
||||
/* ICV error or CCMP/BIP/WPI MIC error */
|
||||
if (rxd1 & MT_RXD1_NORMAL_ICV_ERR)
|
||||
status->flag |= RX_FLAG_ONLY_MONITOR;
|
||||
|
||||
chfreq = FIELD_GET(MT_RXD3_NORMAL_CH_FREQ, rxd3);
|
||||
unicast = FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) == MT_RXD3_NORMAL_U2M;
|
||||
idx = FIELD_GET(MT_RXD1_NORMAL_WLAN_IDX, rxd1);
|
||||
hdr_trans = rxd2 & MT_RXD2_NORMAL_HDR_TRANS;
|
||||
status->wcid = mt7921_rx_get_wcid(dev, idx, unicast);
|
||||
|
||||
if (status->wcid) {
|
||||
|
||||
Reference in New Issue
Block a user