Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp840974pja; Wed, 1 Apr 2020 09:39:40 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtrXyRv/Ly2cg1jilY5HD0kcZdSA5iONid6ca2czQSK/EzBKxmE+pltWYVVHR/Jv1TbR/8Y X-Received: by 2002:a05:6830:148c:: with SMTP id s12mr4872358otq.147.1585759179819; Wed, 01 Apr 2020 09:39:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585759179; cv=none; d=google.com; s=arc-20160816; b=dUpQIHOj1OdXCla65zkTata5iIfJXyUP+V9oJ52JQmvnFIVFe/uJhkyR8lkJiAA3pY zBjEB2pqTBDg/pC5UCfAkgTRnrRxv8Vs0d0qzeUxWqUX2/yc8ILu0VjU3N0Ykj5hrVa1 LQkLZGXsLVpjht2yARWjGCBWEjYxcPi+2AWBHIupAHJD0w5fJ48/mj7A6z93lGBwxlSO oypNYV+b/OMCOeUYzreU69kJSztoMJsUf+YNfgCqQmHMTIqEpUUJkKoqdtDwA0gfrKqC 2LUpvt8NfHlgI+MalJPgHRM505ghvKmBQJmyrvgA60jVCQexQImxWCd5Mkjgj67jrSAo Euzg== 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=4WUZw1Qg1mHIDLcfSgYG+pWtwJBk7rM44TSlr9Jje/A=; b=HWqA/1lkw36YbFexsRtXahCWk+8V0zjjvhW0vvGwK24fCWC0vF05WP5tqJ2bwdfCme rR/lQsFytIqCbzTgoG2fdy3lc8jwbgZ7ixD1y/mY3LDgSi0ytdyiNodEQhc40nD7D1WY B4dJVjGo98wsh//HtPBKYSg/5xDqqlfl82iJ96MoF90XBmW5dEqQhV3AzEX7G77cfuDY zFuprWKKDPWf+DIJOp5YvuYtM4NRgUoWek3Tyjp2UvN6NVhZAVC3ZwLtNIHFN6upyyug H2QjXQVbospGyOMgZpW6V37kzTIkoi2hZrV1EDOvrB1fzSHFNIt0jAScyAjDaYh74ggU /0Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZIDbxPEd; 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 s11si994651otq.83.2020.04.01.09.39.26; Wed, 01 Apr 2020 09:39:39 -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=ZIDbxPEd; 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 S2389157AbgDAQjC (ORCPT + 99 others); Wed, 1 Apr 2020 12:39:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:38882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389151AbgDAQjB (ORCPT ); Wed, 1 Apr 2020 12:39:01 -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 65D54214D8; Wed, 1 Apr 2020 16:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585759140; bh=GauZb6dHMyz2R4rmS5GEIj7YAt4mU6G0N83gbZEowaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZIDbxPEdUvzycAEV1C3uOH/J0zEP9jhnegIrbLwQ/LOYafNLymY4zpP8ao7YUeKJL jTqBPim4FjYv2Yr8A1CcYwz9AvZAaZ6IH2mx643JnbQctHjxFbeE5sHXOExv0FjFyJ 6pcguVQo3Wd5378e07TnHee2U5/SJ+z6x8wJuHfE= 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.9 090/102] mac80211: Check port authorization in the ieee80211_tx_dequeue() case Date: Wed, 1 Apr 2020 18:18:33 +0200 Message-Id: <20200401161547.322161405@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200401161530.451355388@linuxfoundation.org> References: <20200401161530.451355388@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 @@ -3412,8 +3412,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