Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp848793pja; Wed, 1 Apr 2020 09:47:54 -0700 (PDT) X-Google-Smtp-Source: APiQypJHpjISvsQndjmG10JzCWNlGNGe37TPtk8xtiTRlcK4FkrB71ZGieLiHJWM6reHz2zXJr/l X-Received: by 2002:a05:6808:4e:: with SMTP id v14mr3622713oic.70.1585759674228; Wed, 01 Apr 2020 09:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585759674; cv=none; d=google.com; s=arc-20160816; b=kzrsjudYVgGoEvWQ+gUmxe6hPTCr8xvahlR2yngyCRB46R6ajxD/vAPAoAm+rZKh2X Iao8IuuMJyBFFu+ZKeOu9+i2fMr0xIPksQ2xo01Udi3loC9NiWSdV3QgyghdSZ6tczxP QOYALC7lLT6dW2TC1XpPD5qTKwXsvHCSqZlFnBB5n8nlCpCS2VuMrshNnJDMPg4NZzMU bc4KlYaEFjqxsvyaKWpiUp0njou9Oh8mLXgXCVeZEhsP48tP+MLMeq1dseFSkZ8He0OB gZU57CZ+dfVLnGCP5Vc9T+P7sy4JAd7bOofqiJxrm4QntHMf4SIckzLaUQV6IEmQwjmv ikBA== 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=WwP+D3bDkzlEODwnxY76bjLjkY9JPxH1UMz+9NZU3Dc=; b=g4pWVOtjOga/UeNNUzl6YnnRjSM4/JighAsnDfHGnF2gcp4D9mVC95yDJZ3yKz7hce jSYEeWAWpYyligfAfW0Phe4vkzHGfQ2FjAJlHPqrPtUmgQkaQNx1W0UVGLzyNQd/0+nx 5B1bwW/H3D89mRCmElvRK4OWFaOSm4Crwjcmva06SmkvUZfdMqpvHJ/wrlRq1CxU+R6x RNkXsDV4XoRrMVqzzeZrpp0sJ9BPbgu4RGKKh6bthuwCueSXrcpvkaq9JfZk3H0CxsJS fHuJZcupV6fxNWVca3j4qTk1nIf5vOPLK3646ECwiPd7xbD+ILytiTkX+XB9z8TC0LFB YVWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SkwviGGQ; 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 j25si1032028otr.178.2020.04.01.09.47.40; Wed, 01 Apr 2020 09:47:54 -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=SkwviGGQ; 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 S2389963AbgDAQqh (ORCPT + 99 others); Wed, 1 Apr 2020 12:46:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:48034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388548AbgDAQqg (ORCPT ); Wed, 1 Apr 2020 12:46:36 -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 E268520784; Wed, 1 Apr 2020 16:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585759595; bh=9SiWRo32QjcVcO92+jDFuQcYrCcSWv4U40YAVttABYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SkwviGGQlorC+6Kz8066AyreRN7gJyp+F0DvRgH6l89GGjuBZ6YOtLhgFgweg2rlo LSRGOTreRjglpLViV2HUVYU3D32CIhbfG+L87m1A6hLF3F2veJ98OcVqXFUehDQLVA p7HHZv1wpLHnUsduBKbikbhojcZ1AmvOivaKp3Tk= 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.14 130/148] mac80211: Check port authorization in the ieee80211_tx_dequeue() case Date: Wed, 1 Apr 2020 18:18:42 +0200 Message-Id: <20200401161604.859161426@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200401161552.245876366@linuxfoundation.org> References: <20200401161552.245876366@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 @@ -3451,8 +3451,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