Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp858328pja; Wed, 1 Apr 2020 09:57:43 -0700 (PDT) X-Google-Smtp-Source: APiQypJc2NrVcgz+X8EYlYT+FTtkc2Dgukcq4COP2UP98wg/JVINpSQXqDd+bvwOSND9K3YNDv8F X-Received: by 2002:aca:4046:: with SMTP id n67mr3650091oia.156.1585760263656; Wed, 01 Apr 2020 09:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585760263; cv=none; d=google.com; s=arc-20160816; b=ycFiigCKEfVidzk6Faq8TStLgPfhqbDSNDWPLz60ADLIcDx/yqH979IVh/hEPbX6xx qlJVn4n0DP8soiuSYN+Q9pKzDNElVl7ARobP24E7+wclPvMwmZyibvxPAYGBHMrOkgj0 wA05LUBHngLEbkprtv3spSIJPoMI8yH+Xzsl8h6ur9+maQvyoKAy9gmxRCwsAP07aR6D ImRooarbAGDhil1BhSRK26nh08IdrtCDj3TsZVTJIL9t2vi2esoIXMeAkLWja/M1JAzP cYGBNy+l0767/lL0ImFd/WtVS3cDvAlALf8AKytIkWckIyhoSRjV0naNrNJbll+GqUCg 0JtQ== 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=7kVmpazhHub67hul15MRyYW2GXfNID3iOB2IXc3u6fk=; b=exVcQBYQe3KzYdTWPtaCPq0U4qqFgOfjNf2wnh+CUKk/N8tThzFEdLMssaNVj9PyAL DiST3VZhBIpVPbH4EZ3dC5MswWG2SZ9FkqTzPtbRLWm+10IMetoQnDG5Cvl852WSFXej BnsE48UcLhmXqd/C4+wKgl78Fn+ObVd1bjwvpirFUfYqN46FuKrPrgPw+YS+5+zn1zy+ W9IhjZD2glNE6wCH4nY7SpfG/Mo0uT60j0bwFokhKU6GinGeLTc4I3K7S1ppHCo1+B8e peeah7P0OOcG9TwlwuUzLT3IbMbFcM8yuYcV2yeIawJ7ANQLBSaKQw+O8pcdsvqfYGKY 0DFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=btHH2dDd; 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 64si1036516otn.173.2020.04.01.09.57.31; Wed, 01 Apr 2020 09:57:43 -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=btHH2dDd; 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 S1732994AbgDAQU3 (ORCPT + 99 others); Wed, 1 Apr 2020 12:20:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:43066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732943AbgDAQU0 (ORCPT ); Wed, 1 Apr 2020 12:20:26 -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 C653120658; Wed, 1 Apr 2020 16:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585758026; bh=d6VKuddZD86LFfUIk9GqNfHzWMUmnWM9/G4hQecQH5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=btHH2dDdnZ+faT1W2865E94WCOM/7g1nt8pf2HfF4R/OsfQPdqoqSZVqYbDktojT8 0K0PZCBZItx/0cjwme7gqeDLnrOuSz7zyRXotes709lkrRAx+C1EEe7U65D9vhTE+/ Eft3O0NzaNuS5U2wl/+1woCg2RafItaA7L/A+OP8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jouni Malinen , Johannes Berg Subject: [PATCH 5.5 02/30] mac80211: Check port authorization in the ieee80211_tx_dequeue() case Date: Wed, 1 Apr 2020 18:17:06 +0200 Message-Id: <20200401161416.929794261@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200401161414.345528747@linuxfoundation.org> References: <20200401161414.345528747@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 @@ -3604,8 +3604,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