Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp831344pja; Wed, 1 Apr 2020 09:30:04 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsSZAWmGQOBjwySGgzGfd/9n/DGIHGUWcjo6jsfosPnBqCqYyAO5uZZqPRQ3UhinIX1ThSB X-Received: by 2002:a05:6830:101a:: with SMTP id a26mr14720739otp.173.1585758604119; Wed, 01 Apr 2020 09:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585758604; cv=none; d=google.com; s=arc-20160816; b=OR6xf+MXpTetI9exK9dxw+AFDjaYxJe/G6f4SozN3jAriOqsmkXMfk+dB+fz+sZW1/ ko1EItAZyVxwV6nj3Wql9nAGsjCWBZoiX1c8A3Ksdn6QqZsTTmdIJaeeK8fqUlZK/jvi O70TGl2MbIjJtko3KUvcEWjrmObijKJILGMnJHsrS0mrX43K6KbheXN5N7FU4+WEkw0Z eIVLktKdiuVaGlY7UqQXIbaAits/kRcbL6N8NzUJyyqP041k0oZ624seawWIMaKLfVhg GuoUnwWD9nUrxN/TifLylgGl7xThbS73ETbJTtkzrNUVmVN/l70bSKj4fYEyqhWHqVoo werg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v1tiLiYFUgAyuYuddp/n1f+NfUP5WG7Kd11WVN84fGY=; b=nfPeOc66dYV1E7k1LRPPmKTet7UmXf/AhkyAznJcaJe1O6TeixL/cLa4GeS2cnCQ0Y TRbHoBCAPtOMwK98CGRStEBLmDY31Vf61os/qn1TsJT6ghpHgB0ljaYZDlCCsvyHfRjR xhBNdperJkWJAeh4/daDRNUXjNeNR8TfXJl3Kr9NgYui7jdgwbhlibbiRCHQlPYRnian 9ifjYqkypQB8h8rOua6YwAmpvoJJmxEZOadkzzbfGi5ijQRYOhw3A19528bDv1KO/Oyo cnTKHNZvPcv0UNGdQ0JCtg1XAdlRdXttxZaonze+k4TzZxxefZb0MGt0e9JB8PjgBoU9 8E8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="s/eIhE18"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 f136si1173952oig.9.2020.04.01.09.29.50; Wed, 01 Apr 2020 09:30:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="s/eIhE18"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388024AbgDAQ1j (ORCPT + 99 others); Wed, 1 Apr 2020 12:27:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:52494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387850AbgDAQ1i (ORCPT ); Wed, 1 Apr 2020 12:27:38 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 177C620857; Wed, 1 Apr 2020 16:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585758457; bh=ir7hZzhLHTgj+JI3LhcJCr1TBbLgHw4uZM6ow7QWwZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s/eIhE18wD4cmaUZjHk2f9EyLdoRn4ZC6dUmgr6CnfM+tFJDNuxop3QR8GPzXzhj6 G3zhbYD9Yx0T36TvVPWihRbvEZPHOBNB4FJ2C9Q+Od+rkpUL0KIKi3213eP12dqJGW 9XbxLg3hRJrxp3qjfRGShHF4s+psM88CACrc8OpE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jouni Malinen , Johannes Berg Subject: [PATCH 4.19 096/116] mac80211: Check port authorization in the ieee80211_tx_dequeue() case Date: Wed, 1 Apr 2020 18:17:52 +0200 Message-Id: <20200401161554.642230437@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200401161542.669484650@linuxfoundation.org> References: <20200401161542.669484650@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jouni Malinen commit ce2e1ca703071723ca2dd94d492a5ab6d15050da upstream. 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 Link: https://lore.kernel.org/r/20200326155133.ced84317ea29.I34d4c47cd8cc8a4042b38a76f16a601fbcbfd9b3@changeid Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/tx.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3513,8 +3513,25 @@ begin: 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