Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2699141pxj; Mon, 31 May 2021 08:32:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbPv2/SBgSl74G+EgiMmIHIuCerIh4O+TutvlOQ8wGWA9fycKp6KKPmTxHiKe9VJoDJVZ7 X-Received: by 2002:aa7:de1a:: with SMTP id h26mr5983399edv.176.1622475153606; Mon, 31 May 2021 08:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622475153; cv=none; d=google.com; s=arc-20160816; b=omuiWBxU4plEcZr7tEjlD1KqAKMEr1NK65tQu1btwrrxN3YrEXuoWEN1//SNGHG2VJ BcMU/66q310OjJ0HtV2SQtq77nZQg2cosZnGpkCEv9R2oU8G23pwzmQ/Y82qs26Y1o40 0s3VI80AkqjrJGdbEcQv/FqD+GL/o91Jy0WcwkpBoyD8BYun5XKh+fn035p+ZvDt2HoB rj9VBLQifrby38WzHpU2KPes+QroDBsiORcL1HoPcailBds9PGI8QdA+qpNuv0joFNtl OVxw9O4Rwu2kFKNUdGweU8RoMTffYyuIuNRwXl4t7sD8c1ptd9NOSAA2A+sjEw86YPQj lSfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OBACtHfjhsA+uFBqO6N8LW+8EbLNP9hy+lOkk8TBKwI=; b=ClsuWxDDlV3ArezKbWmpKbY540NnvpCmbHVlk+J9hRUi1PSAeLcKk5aBGvZedcqAxF CfJE5nSxu/KbUrxlMCGwQ/rZZ2ebVCI4ayxTfCTxfnksAa12i4sT2wFuaP0YTKBDvwFi 7ddBbXD2JwFX4+I5b1io4Oxba+Ed59QM1JxV8ktNNA/BDSJDAYlS7dHa8hf/SKDmVxpu nk4xvWZd2MgnQw793mx1GQvg6dZ2f9dUyOuu9MYxWJqhFpcWclhgIAv+1COe08VpcUKG K6KvxOmktEzdzRDfVzZHS1v+Qn2ODh0D9Z9Jiv5LtMY37ldXUfopNA3bYmk8nY2UzRqZ wBQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tCeXXOvR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w18si274030ejf.528.2021.05.31.08.32.11; Mon, 31 May 2021 08:32:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tCeXXOvR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232906AbhEaPc4 (ORCPT + 99 others); Mon, 31 May 2021 11:32:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:42684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233046AbhEaOQf (ORCPT ); Mon, 31 May 2021 10:16:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 75ED3619AA; Mon, 31 May 2021 13:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468596; bh=TisUyjmq6Jf10cjaHraampdWJw59O44vfAoBBgO0vNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tCeXXOvRxx8sqoJwcWsrC9+MbiAPLy35R9uCH9fOudqJwT98X6ix+RFY99jdHKPRM t+j0heOybK08ywzvJbZJ4dy9MueQqh/SPRIFAVadnri+dn487f/flaCORnw3yDbUpJ g8/jNuX5We2AsdWF2YEnbO3cXwt/8zDFGRNsjNDU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathy Vanhoef , Johannes Berg Subject: [PATCH 5.4 016/177] mac80211: properly handle A-MSDUs that start with an RFC 1042 header Date: Mon, 31 May 2021 15:12:53 +0200 Message-Id: <20210531130648.473025795@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathy Vanhoef commit a1d5ff5651ea592c67054233b14b30bf4452999c upstream. Properly parse A-MSDUs whose first 6 bytes happen to equal a rfc1042 header. This can occur in practice when the destination MAC address equals AA:AA:03:00:00:00. More importantly, this simplifies the next patch to mitigate A-MSDU injection attacks. Cc: stable@vger.kernel.org Signed-off-by: Mathy Vanhoef Link: https://lore.kernel.org/r/20210511200110.0b2b886492f0.I23dd5d685fe16d3b0ec8106e8f01b59f499dffed@changeid Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- include/net/cfg80211.h | 4 ++-- net/mac80211/rx.c | 2 +- net/wireless/util.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5194,7 +5194,7 @@ unsigned int ieee80211_get_mesh_hdrlen(s */ int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, const u8 *addr, enum nl80211_iftype iftype, - u8 data_offset); + u8 data_offset, bool is_amsdu); /** * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 @@ -5206,7 +5206,7 @@ int ieee80211_data_to_8023_exthdr(struct static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, enum nl80211_iftype iftype) { - return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0); + return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false); } /** --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -2634,7 +2634,7 @@ __ieee80211_rx_h_amsdu(struct ieee80211_ if (ieee80211_data_to_8023_exthdr(skb, ðhdr, rx->sdata->vif.addr, rx->sdata->vif.type, - data_offset)) + data_offset, true)) return RX_DROP_UNUSABLE; ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -451,7 +451,7 @@ EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen) int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, const u8 *addr, enum nl80211_iftype iftype, - u8 data_offset) + u8 data_offset, bool is_amsdu) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; struct { @@ -539,7 +539,7 @@ int ieee80211_data_to_8023_exthdr(struct skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)); tmp.h_proto = payload.proto; - if (likely((ether_addr_equal(payload.hdr, rfc1042_header) && + if (likely((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) && tmp.h_proto != htons(ETH_P_AARP) && tmp.h_proto != htons(ETH_P_IPX)) || ether_addr_equal(payload.hdr, bridge_tunnel_header)))