Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4643369ybl; Wed, 22 Jan 2020 01:55:13 -0800 (PST) X-Google-Smtp-Source: APXvYqy23vsmQVlwpBYoD/JaAG8boTQH2TXWYtcAqJa5lGO2k6Oz8YbAjF7d2RU25++vI3/sTsfh X-Received: by 2002:aca:48cf:: with SMTP id v198mr6277776oia.35.1579686913316; Wed, 22 Jan 2020 01:55:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579686913; cv=none; d=google.com; s=arc-20160816; b=cjsrHzS8EVlxDQIGrJAE0Qu8yMcpHq+eF3PM3BcNbAPIUMaiIvWbziJ+RyXcnDJyoT en6Moasu4RxfAX3+ZbJ+4pG7z3WCfjdrsMLf9uerfZAiHOaJIpfF7ELcaQTiwJa2vnLO hktOqrQ9QcpMo62zan0IT2b8CnYYSrObASI/9XcQarfoFsL0m6p61CvzY6S/LYbg/hpZ gPEZZXrC3zEpeVO0ZBtXjZPnOfMTyxeez7UTy0da/wAJ3OmXR5DQezu8CxHdNkxAH9WC XGHOwootO6zkzQQk3CjgdnFcHgG3/pptvUazWP6kFpTFG722qqUK9t+iipNJeNdrReaI g/VQ== 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=+nB/IxJBO3q2ED74tUlo+lfxvx84eyrHlWJCsCYnmSo=; b=E9ww4xINTOG9vUuJ18Mnq69pgl3d2JPC5lsmDOCY+Wc511RFgHhIYZOD5i1xFK2kGK pHznilsNORSQC01MO2a0M+9phAGU4pTzPqoe45l8owTDUpI4T5QtStnD8S0u1eu+Fn54 lZgodNlMbr0mi1+g8Y3dNicRK5gZ+5uGbETnY/dEnTK9pyGmUZLFe1EncABEZoEHiJZ4 EH3K+4wHRAdB0XmtqinVxhl3DCWrbZZqQC4fUqVIgl1WAvoEsK53lEmWcrEy5tQp34e+ jYlRUr7djT3qys9hL9Mj7/ooaC6cUDV8iRfUDe9qGumdNHYUBNhl9nmHlhhxs7Y6qnQA /lfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zd2xM5+e; 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 u18si26953143otg.201.2020.01.22.01.55.01; Wed, 22 Jan 2020 01:55:13 -0800 (PST) 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=Zd2xM5+e; 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 S1730540AbgAVJxP (ORCPT + 99 others); Wed, 22 Jan 2020 04:53:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:50726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731379AbgAVJfe (ORCPT ); Wed, 22 Jan 2020 04:35:34 -0500 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 5650424673; Wed, 22 Jan 2020 09:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579685733; bh=UfNcciLhGR8mUtx9Sy6RXf1jvwXSevNstUj4IZjS/Dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zd2xM5+eqcqXJmgqBYsg1ahGg8nhIMVTxZW/mhvlwTdPZ/mlPuiKyEH6zVAFeknXb /clmJ1b5Z/6CWOgzGB+bJNkn9kS156GItzAgxdLSdyhci0pHktJst/Z2zVbfJBqP4n eABrql75kBGi+p9g2TLhKZkjaCh8vku8ObaBq+cw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jouni Malinen , Johannes Berg , "David S. Miller" , Ben Hutchings Subject: [PATCH 4.9 13/97] mac80211: Do not send Layer 2 Update frame before authorization Date: Wed, 22 Jan 2020 10:28:17 +0100 Message-Id: <20200122092757.991592555@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092755.678349497@linuxfoundation.org> References: <20200122092755.678349497@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 3e493173b7841259a08c5c8e5cbe90adb349da7e upstream. The Layer 2 Update frame is used to update bridges when a station roams to another AP even if that STA does not transmit any frames after the reassociation. This behavior was described in IEEE Std 802.11F-2003 as something that would happen based on MLME-ASSOCIATE.indication, i.e., before completing 4-way handshake. However, this IEEE trial-use recommended practice document was published before RSN (IEEE Std 802.11i-2004) and as such, did not consider RSN use cases. Furthermore, IEEE Std 802.11F-2003 was withdrawn in 2006 and as such, has not been maintained amd should not be used anymore. Sending out the Layer 2 Update frame immediately after association is fine for open networks (and also when using SAE, FT protocol, or FILS authentication when the station is actually authenticated by the time association completes). However, it is not appropriate for cases where RSN is used with PSK or EAP authentication since the station is actually fully authenticated only once the 4-way handshake completes after authentication and attackers might be able to use the unauthenticated triggering of Layer 2 Update frame transmission to disrupt bridge behavior. Fix this by postponing transmission of the Layer 2 Update frame from station entry addition to the point when the station entry is marked authorized. Similarly, send out the VLAN binding update only if the STA entry has already been authorized. Signed-off-by: Jouni Malinen Reviewed-by: Johannes Berg Signed-off-by: David S. Miller [bwh: Backported to 4.9: adjust context] Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- net/mac80211/cfg.c | 11 +++-------- net/mac80211/sta_info.c | 4 ++++ 2 files changed, 7 insertions(+), 8 deletions(-) --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1357,7 +1357,6 @@ static int ieee80211_add_station(struct struct sta_info *sta; struct ieee80211_sub_if_data *sdata; int err; - int layer2_update; if (params->vlan) { sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); @@ -1401,18 +1400,12 @@ static int ieee80211_add_station(struct test_sta_flag(sta, WLAN_STA_ASSOC)) rate_control_rate_init(sta); - layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || - sdata->vif.type == NL80211_IFTYPE_AP; - err = sta_info_insert_rcu(sta); if (err) { rcu_read_unlock(); return err; } - if (layer2_update) - cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr); - rcu_read_unlock(); return 0; @@ -1521,7 +1514,9 @@ static int ieee80211_change_station(stru atomic_inc(&sta->sdata->bss->num_mcast_sta); } - cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr); + if (sta->sta_state == IEEE80211_STA_AUTHORIZED) + cfg80211_send_layer2_update(sta->sdata->dev, + sta->sta.addr); } err = sta_apply_parameters(local, sta, params); --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -1896,6 +1896,10 @@ int sta_info_move_state(struct sta_info ieee80211_check_fast_xmit(sta); ieee80211_check_fast_rx(sta); } + if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN || + sta->sdata->vif.type == NL80211_IFTYPE_AP) + cfg80211_send_layer2_update(sta->sdata->dev, + sta->sta.addr); break; default: break;