summaryrefslogtreecommitdiff
path: root/drivers/staging/wfx/data_rx.c
diff options
context:
space:
mode:
authorJérôme Pouiller <jerome.pouiller@silabs.com>2020-07-01 17:07:05 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-03 10:33:07 +0200
commite5da5fbd7741162c51a70ffad4316be12e1bb010 (patch)
tree92e8337a1ccbd1aa35301cb2ab17579f21728383 /drivers/staging/wfx/data_rx.c
parentbbc409e276c948a7acda32cab5d8f26335c34ac0 (diff)
staging: wfx: fix CCMP/TKIP replay protection
To enable the TKIP/CCMP replay protection, the frames has to be processed in the right order. However, the device is not able to re-order the frames during BlockAck sessions. Mac80211 is able to reorder the frames, but it need the information about the BlockAck sessions start and stop. Unfortunately, since the BlockAck is fully handled by the hardware, these frames were not forwarded to the host. So, if the driver ask to mac80211 to apply the replay protection, it drop all misordered frames. So, until now, the driver explicitly asked to mac80211 to not apply the CCMP/TKIP replay protection. The situation has changed with the API 3.4 of the device firmware. The firmware forward the BlockAck information. Mac80211 is now able to correctly reorder the frames. There is no more reasons to drop cryptographic data. This patch also impact the older firmwares. There will be a performance impact on these firmware (since the misordered frames will dropped). However, we can't keep the replay protection disabled. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200701150707.222985-12-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wfx/data_rx.c')
-rw-r--r--drivers/staging/wfx/data_rx.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c
index 60e2e5cb4656..6fb078880742 100644
--- a/drivers/staging/wfx/data_rx.c
+++ b/drivers/staging/wfx/data_rx.c
@@ -13,6 +13,24 @@
#include "bh.h"
#include "sta.h"
+static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt)
+{
+ int params, tid;
+
+ switch (mgmt->u.action.u.addba_req.action_code) {
+ case WLAN_ACTION_ADDBA_REQ:
+ params = le16_to_cpu(mgmt->u.action.u.addba_req.capab);
+ tid = (params & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2;
+ ieee80211_start_rx_ba_session_offl(wvif->vif, mgmt->sa, tid);
+ break;
+ case WLAN_ACTION_DELBA:
+ params = le16_to_cpu(mgmt->u.action.u.delba.params);
+ tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12;
+ ieee80211_stop_rx_ba_session_offl(wvif->vif, mgmt->sa, tid);
+ break;
+ }
+}
+
void wfx_rx_cb(struct wfx_vif *wvif,
const struct hif_ind_rx *arg, struct sk_buff *skb)
{
@@ -53,15 +71,18 @@ void wfx_rx_cb(struct wfx_vif *wvif,
hdr->antenna = 0;
if (arg->rx_flags.encryp)
- hdr->flag |= RX_FLAG_DECRYPTED | RX_FLAG_PN_VALIDATED;
+ hdr->flag |= RX_FLAG_DECRYPTED;
- /* Filter block ACK negotiation: fully controlled by firmware */
+ // Block ack negociation is offloaded by the firmware. However,
+ // re-ordering must be done by the mac80211.
if (ieee80211_is_action(frame->frame_control) &&
- arg->rx_flags.match_uc_addr &&
- mgmt->u.action.category == WLAN_CATEGORY_BACK)
+ mgmt->u.action.category == WLAN_CATEGORY_BACK &&
+ skb->len > IEEE80211_MIN_ACTION_SIZE) {
+ wfx_rx_handle_ba(wvif, mgmt);
goto drop;
- ieee80211_rx_irqsafe(wvif->wdev->hw, skb);
+ }
+ ieee80211_rx_irqsafe(wvif->wdev->hw, skb);
return;
drop: