From c993cbae6e07d3e589221347d856b0cd52cb14ad Mon Sep 17 00:00:00 2001 From: Ahmad Masri Date: Sun, 3 Jan 2021 10:27:49 +0200 Subject: [PATCH] wil6210: Drop plaintext frames on secure network On secure network, only eap frames are valid unencrypted frames and allowed to be indicated to the local network, any other unencrypted frame should be dropped immediately. Change-Id: Id9d97a4c0984f7bf2d7d6941c4c61e87bc2354cd Signed-off-by: Ahmad Masri --- drivers/net/wireless/ath/wil6210/txrx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index 72cd994a9f4d..c76c3eb4a641 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c @@ -1002,6 +1002,7 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) { int cid, security; struct wil6210_priv *wil = ndev_to_wil(ndev); + struct wil6210_vif *vif = ndev_to_vif(ndev); struct wil_net_stats *stats; wil->txrx_ops.get_netif_rx_params(skb, &cid, &security); @@ -1010,6 +1011,18 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) skb_orphan(skb); + /* pass only EAPOL packets as plaintext */ + if (vif->privacy && !security && + wil_skb_get_protocol(skb) != htons(ETH_P_PAE)) { + wil_dbg_txrx(wil, + "Rx drop plaintext frame with %d bytes in secure network\n", + skb->len); + dev_kfree_skb(skb); + ndev->stats.rx_dropped++; + stats->rx_dropped++; + return; + } + if (security && (wil->txrx_ops.rx_crypto_check(wil, skb) != 0)) { wil_dbg_txrx(wil, "Rx drop %d bytes\n", skb->len); dev_kfree_skb(skb);