Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2687795pxj; Mon, 31 May 2021 08:16:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw0w1UzUD+6rH5ZwVnaRCkZ2FHcBednzcbmKEVW3MVtJlzuWUgQkX5VPMeKs0g9w+O1D4x X-Received: by 2002:a05:6402:50d2:: with SMTP id h18mr26464899edb.10.1622474196038; Mon, 31 May 2021 08:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622474196; cv=none; d=google.com; s=arc-20160816; b=GQYb1GDkVi6XmatnBu6XKAy1HhD9U3Kp7GYxb2kbx19HtJJT6bnt54R6djGq39Snip TruXQLAYQIL7xWhl8ENOzQ+4rG9nKRivpGl2qpJ7v3NU7SnH9LSOfRlMcSC2AYjGRoP/ s5NHb73q4qC1c8wI/rbSFnR6Z4QKl4M71Jf7b3zW/UzQjkKGxMZbMQxNU/QnKTqqZjkV Y6VvWKAaZK956SevK0PpQfrXzCyaUTCHroYpxxwyVmoAa0GLBWV/mQWyrbtaC6QPP5T9 XzQ0QMRR1iTuQzG/6RG8Vjsvy4gmgNHYinzSPvLrwLsjgl1lslvwOu23+dATSjXi0+iP zTaw== 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=6J1vlGJwPGX0h+ZSlnUDAwD1ZLzHXRm+/YcPAARqnVw=; b=hP9KmndP9a7Tw5C8kiAeq4wzeV8q1Xt+aPR6b/XIJLtmAtOj0HdqcSpSGGl+Ru3p0L ZHzVNofyj2oU1DpV10Xfi5FSD16YzLVZ1K96Z6OuqNBhsBDysnUiu89fj8Q2GOYW9bB2 MVobS1U4EzkFgrO7hgXInxQrcii2FGvrrnyyIYHJc54iP1SyTcwLabX02Fpd18f9b5hy DP/T7WEJpIR7+NaGYT0FkpfDopJB6quPWt3sfiz/pia95QY7XIAvpg2QDucQoFQOMtHC 74gZbcFwHUE5nklYbPgegPSvXGwb1gxuQp9R7PGLCLN8WcXn3esnR3aPC6P0LYXUvk02 vNWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kORbYk39; 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 l8si5586757ejc.229.2021.05.31.08.16.13; Mon, 31 May 2021 08:16:36 -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=kORbYk39; 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 S233186AbhEaPQz (ORCPT + 99 others); Mon, 31 May 2021 11:16:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:43308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233023AbhEaONj (ORCPT ); Mon, 31 May 2021 10:13:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CD83D6146D; Mon, 31 May 2021 13:42:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468530; bh=8Oy81VEdXomROfATdpP8vyT3Lrxeamkk3bpNm7pWYCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kORbYk392kBHm1ghStJnAUR4QKwXM/BQ/x+U0lc6ynta7nng2iGdHEpV5552n4F/j bVeCOZ/LipdvCRvtuOjDTKU5v1crQmWwY4KRchwY1FuywJ6Zt0aIOfeH63dN26Nbtb 6NDSiAQn/DpjywUt570a4WGCtQqYqYYLK2z5TLy8= 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.4 025/177] ath10k: drop fragments with multicast DA for PCIe Date: Mon, 31 May 2021 15:13:02 +0200 Message-Id: <20210531130648.785266963@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: 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 @@ -1761,6 +1761,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, @@ -1832,7 +1842,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; @@ -1939,13 +1949,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; }