Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1816653ybb; Thu, 26 Mar 2020 07:52:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuobn5cyzq0g8iDC/ipUhs+mmWSLowfE3MxolNAY15qpANpMR5+M+95oANSq3o27aoQ2qAJ X-Received: by 2002:aca:3c56:: with SMTP id j83mr315470oia.52.1585234337633; Thu, 26 Mar 2020 07:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585234337; cv=none; d=google.com; s=arc-20160816; b=KC0NdOtYEH7ZZ6lKTTT+WEPDMSyd7YLSMsrz82mTaBYoygKMvZvvJLK6OaRaQfs61D DSj8vgJd0lUZ2wcTKR4A3SLZ2e9StTmJhEcd9lX6+hHhp8ddjdEFV6c+UPVY+yyOY9/t 4ickRENiJW6n2uhH1YIs8EPuWcQHC9tX8zb45lMgrsiiT6BoegnUG3Cez93ylIe5Wt9i SzSVQZ7lXb+6/LnueK7dqcLEO6sKhJfFU6mYV3+vFM/fy37eO3w+vMldz/XApnU4+r4A dbHBMWfQh/8dLW9sykNbQjolvm89RQXD9eun9TEvtMarOJ7uY1zDfjNsKTff7MQGnmlW jERw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=8EXTwgd16tbJ70IRF+aqwX9JqtWAX6TbwXOfvwPtTIw=; b=ePio0cXICgXWRSPxQbXkj27vg1PsPohgKZL9qyDU9ETnIYeaTz1Hqm+fnb8HhglmE5 EvV8w9edVzsWWF01iMmQ0VLZ8+h6tYRNM3mCnE6/++KxGhrU9k31GbOK97e4CBMihGs9 CsXPiY/JkZOomSPWn8F/SB7lRMXv6UgAxhAseFpOzanbfQt2A39hOpGacSWcGXKDu13Z JZMXLbz9ap9rFvicp3c9gzgiwMauVvLFZtx8WUJLQcRbMs1JTQ9JqeHVP59nfQIzHgf2 vMD5va9xNhWrasVRsko/snMJGFfpHD0DxhP+e4RNSNBoGRJzgHXIkNHIzGqpGu7yt5Md 7UMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 141si1083687oii.44.2020.03.26.07.52.05; Thu, 26 Mar 2020 07:52:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728123AbgCZOvv (ORCPT + 99 others); Thu, 26 Mar 2020 10:51:51 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:48756 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbgCZOvt (ORCPT ); Thu, 26 Mar 2020 10:51:49 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) (envelope-from ) id 1jHTrH-00BYfo-Gx; Thu, 26 Mar 2020 15:51:47 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Jouni Malinen , stable@vger.kernel.org Subject: [PATCH 1/2] mac80211: Check port authorization in the ieee80211_tx_dequeue() case Date: Thu, 26 Mar 2020 15:51:34 +0100 Message-Id: <20200326155133.ced84317ea29.I34d4c47cd8cc8a4042b38a76f16a601fbcbfd9b3@changeid> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jouni Malinen 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: stable@vger.kernel.org Signed-off-by: Jouni Malinen Signed-off-by: Johannes Berg --- net/mac80211/tx.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 7dbfb9e3cd84..455eb8e6a459 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3604,8 +3604,25 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, tx.skb = skb; tx.sdata = vif_to_sdata(info->control.vif); - if (txq->sta) + if (txq->sta) { tx.sta = container_of(txq->sta, struct sta_info, sta); + /* + * Drop unicast frames to unauthorised stations unless they are + * EAPOL frames from the local station. + */ + if (unlikely(!ieee80211_vif_is_mesh(&tx.sdata->vif) && + tx.sdata->vif.type != NL80211_IFTYPE_OCB && + !is_multicast_ether_addr(hdr->addr1) && + !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) && + (!(info->control.flags & + IEEE80211_TX_CTRL_PORT_CTRL_PROTO) || + !ether_addr_equal(tx.sdata->vif.addr, + hdr->addr2)))) { + I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); + ieee80211_free_txskb(&local->hw, skb); + goto begin; + } + } /* * The key can be removed while the packet was queued, so need to call -- 2.25.1