Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2650586pxj; Mon, 31 May 2021 07:24:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5Xxa37uYeM+qs9Mvi2WN3NQAC8xgb2haoTUAWWFD3IMCsWvO0zMm6ufN6y05Yo7FF2NA+ X-Received: by 2002:a17:906:7188:: with SMTP id h8mr6167972ejk.529.1622471045286; Mon, 31 May 2021 07:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622471045; cv=none; d=google.com; s=arc-20160816; b=oSAhdQhv7rok/unjnqREB7xF+sdV/OjK9lr5oLAMU2DL96g/nqM43gVqUct3KgEw69 7sreBK3fYmr3gfKb0KyeqVS7Z4/VNQRXaIea2CHspqxdrgIIEXCXJdOAyanrdkr9ZGGr HgSZBBcBJOHCeMPnKhKCBxtew490GTn5frtjHwFru1z19vxgsMabEjoyXd106Q31DpeW uMG+80uV2d8Pibl0mGe013uwPQajkVpD9lws2Am1dG9SXoyXH+8zNGu5bCdJqnYa41Hn ZdRUx/aLI3a3ct8Tk95DpRM7rMDDG8pW//ePtFUA7QAhSy9H7WeNF8QFT0ite6shROoG X5Pw== 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=sBm8NKAfrfbKX8XU5gdfwkaWWWS1759E/bn0hCkfg+A=; b=ztRFGk8y34rcdhE7cLLFIOWa4rsMClp9UQJQ3YpMuUEskrl+iKrLPQf9fsObf7hZRK o+o/W1D0kdphqt3A3ALKDYlWhGQlaVMEunnQj1xYt/S8CItjPiLLvZuSUXVVmwPKzfJY S0z0T4pVtZXPOaKB2/HI3kBXSu8F6YsZZlB3iA5JnwTD+w8jk0++8m0S2TuTGpM3unUf uzVgs7Lt7SIriG6UrfOzDl338CaLMw9RV0DchuqjyLhFcPrbiQVEpDNPB3/I09vb6gdV QI6ZceZnQvmPhHathj8PQkvHU/xD+AQ6kfWLqzm+KjhkYuyhZzQvZ3CFYxbcGAXqMasG Pg+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="2qZ/Lbpp"; 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 gt43si12673834ejc.459.2021.05.31.07.23.42; Mon, 31 May 2021 07:24:05 -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="2qZ/Lbpp"; 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 S233934AbhEaOVv (ORCPT + 99 others); Mon, 31 May 2021 10:21:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:55014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbhEaNtE (ORCPT ); Mon, 31 May 2021 09:49:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 09F3161623; Mon, 31 May 2021 13:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467881; bh=2jbfXJ7f5RaIOdtezmbw0mVK6OFiA/m5i/F3TuwnHoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2qZ/Lbpp09ee0T/Hn631IdLd42Qp1vDFe6iAutz0yXv3aVdzvb/Np+g35ao2gd7GA Zm8W+bEt+2QNXXj314Rj1PJoNwit7j9W35e0mOQMBhVIeWEV+dF3oJNYNJshkWO1ww dutANqXMz4W4wYZzttfFkJWso//pBsPH5PsVbINc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Jouni Malinen , Johannes Berg Subject: [PATCH 5.10 034/252] ath10k: drop fragments with multicast DA for PCIe Date: Mon, 31 May 2021 15:11:39 +0200 Message-Id: <20210531130659.141907288@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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: Wen Gong commit 65c415a144ad8132b6a6d97d4a1919ffc728e2d1 upstream. Fragmentation is not used with multicast frames. Discard unexpected fragments with multicast DA. This fixes CVE-2020-26145. Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00110-QCARMSWP-1 Cc: stable@vger.kernel.org Signed-off-by: Wen Gong Signed-off-by: Jouni Malinen Link: https://lore.kernel.org/r/20210511200110.5a0bd289bda8.Idd6ebea20038fb1cfee6de924aa595e5647c9eae@changeid Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/ath10k/htt_rx.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -1768,6 +1768,16 @@ static u64 ath10k_htt_rx_h_get_pn(struct return pn; } +static bool ath10k_htt_rx_h_frag_multicast_check(struct ath10k *ar, + struct sk_buff *skb, + u16 offset) +{ + struct ieee80211_hdr *hdr; + + hdr = (struct ieee80211_hdr *)(skb->data + offset); + return !is_multicast_ether_addr(hdr->addr1); +} + static bool ath10k_htt_rx_h_frag_pn_check(struct ath10k *ar, struct sk_buff *skb, u16 peer_id, @@ -1839,7 +1849,7 @@ static void ath10k_htt_rx_h_mpdu(struct bool is_decrypted; bool is_mgmt; u32 attention; - bool frag_pn_check = true; + bool frag_pn_check = true, multicast_check = true; if (skb_queue_empty(amsdu)) return; @@ -1946,13 +1956,20 @@ static void ath10k_htt_rx_h_mpdu(struct 0, enctype); - if (!frag_pn_check) { - /* Discard the fragment with invalid PN */ + if (frag) + multicast_check = ath10k_htt_rx_h_frag_multicast_check(ar, + msdu, + 0); + + if (!frag_pn_check || !multicast_check) { + /* Discard the fragment with invalid PN or multicast DA + */ temp = msdu->prev; __skb_unlink(msdu, amsdu); dev_kfree_skb_any(msdu); msdu = temp; frag_pn_check = true; + multicast_check = true; continue; }