Skip to content

Commit ce2e1ca

Browse files
Jouni Malinenjmberg-intel
authored andcommitted
mac80211: Check port authorization in the ieee80211_tx_dequeue() case
mac80211 used to check port authorization in the Data frame enqueue case when going through start_xmit(). However, that authorization status may change while the frame is waiting in a queue. Add a similar check in the dequeue case to avoid sending previously accepted frames after authorization change. This provides additional protection against potential leaking of frames after a station has been disconnected and the keys for it are being removed. Cc: [email protected] Signed-off-by: Jouni Malinen <[email protected]> Link: https://lore.kernel.org/r/20200326155133.ced84317ea29.I34d4c47cd8cc8a4042b38a76f16a601fbcbfd9b3@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 05dcb8b commit ce2e1ca

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

net/mac80211/tx.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3604,8 +3604,25 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
36043604
tx.skb = skb;
36053605
tx.sdata = vif_to_sdata(info->control.vif);
36063606

3607-
if (txq->sta)
3607+
if (txq->sta) {
36083608
tx.sta = container_of(txq->sta, struct sta_info, sta);
3609+
/*
3610+
* Drop unicast frames to unauthorised stations unless they are
3611+
* EAPOL frames from the local station.
3612+
*/
3613+
if (unlikely(!ieee80211_vif_is_mesh(&tx.sdata->vif) &&
3614+
tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
3615+
!is_multicast_ether_addr(hdr->addr1) &&
3616+
!test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) &&
3617+
(!(info->control.flags &
3618+
IEEE80211_TX_CTRL_PORT_CTRL_PROTO) ||
3619+
!ether_addr_equal(tx.sdata->vif.addr,
3620+
hdr->addr2)))) {
3621+
I802_DEBUG_INC(local->tx_handlers_drop_unauth_port);
3622+
ieee80211_free_txskb(&local->hw, skb);
3623+
goto begin;
3624+
}
3625+
}
36093626

36103627
/*
36113628
* The key can be removed while the packet was queued, so need to call

0 commit comments

Comments
 (0)