Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp935370pxb; Wed, 6 Apr 2022 04:46:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4b3ZiawPuE+1D2d0gJyM/fFCHTFJiYeQg0Ttj0fzm1u+iAjMgGm6R/3QiyMEHc/EIAjG9 X-Received: by 2002:a17:90b:4d01:b0:1c9:ec79:1b35 with SMTP id mw1-20020a17090b4d0100b001c9ec791b35mr9161045pjb.77.1649245573200; Wed, 06 Apr 2022 04:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649245573; cv=none; d=google.com; s=arc-20160816; b=FUpyD0wNJ+WveFwFcxNz48yhMCqfLljvQL5bna3rAPFlBts5BEcWZR3GdKEmuVGjTo 6Hb7UCZ51c9mrE3/Cy6P1NlHYmQLq+cTqlWkXCdZEAzXmyoQ4iIQVyT40oSqB1WAHiDN HJg/zhP6pTxwD2lT1EzMFYNvvoCNy51uQht6i8tukwRvMGQWFufptq8yR9RhTBS1zGY+ rzNMbBO2h9JZlmPs3UD2FLT90GL745hncVxEMC70xDKSbt+nVD8dzkpf8GqyewmeIRKI cklhVm7j/4WoWTItDUGgaQNT+OdLOqT4uWWntH0TC0iPGlLV2boYfwxI/wqranvX7Vte DMAA== 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=XJTjqmpe2ZSH9e3EP7ifBH/ymgHlyIG+M4248z/mUXE=; b=KClZln3rEiWS7chiZzVpKTfcVDZwOMtf8iUi+8PD02LD/b3FBj+eM2xZk/BblnmBdS cHfmjsbewVG6900wIcF9xi/MQqJCuZyZ5vSNMhCrK+Ah16TWDgF1I9PuEA508U1Znxpe yMIfISI40HQTY/6/VOTEdyJqem7OxAxL4HapzcWgVFAEj56X7zeZoQDaboLhZDgh8KFu htQhebj1GKY/XKvVfBUQoG3de/H4hEu0poHaJWklbSHnbimFHVkMqJWAT391jWBNFshH i+Zj1MMDTatbnGVkfQut62wg3IcwrefKtQAjQA3vS/JVcrKtVteW5d+Lr/hAe1GKoHxp UNGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MTOgMYGl; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q2-20020a63ae02000000b0039895949d28si14256791pgf.575.2022.04.06.04.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:46:13 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MTOgMYGl; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6B054551E68; Wed, 6 Apr 2022 03:02:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1588618AbiDFAQl (ORCPT + 99 others); Tue, 5 Apr 2022 20:16:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358006AbiDEK1m (ORCPT ); Tue, 5 Apr 2022 06:27:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A188D76D6; Tue, 5 Apr 2022 03:12:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 367BC6179E; Tue, 5 Apr 2022 10:12:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45707C385A1; Tue, 5 Apr 2022 10:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649153559; bh=m0gxXestR9TuCF6pwebEyOfHf08GivCI31KBId5HBac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MTOgMYGlg4YHnT7qcNHz1wuSi6Lft4yrQHOEtZZxsPGgLauptd4mjPbnutwEIz1RA ZIU4Din+7r+kr8bjG548O7F1KgVUuVMhNYFM6GISmxcgWL/9frYB2KIvW7HkZ2eheJ hUVVLmm13JI9/5K+51s6PQhG+6rnMen/jIGbv63Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Kalle Valo , Sasha Levin Subject: [PATCH 5.10 265/599] ath10k: fix memory overwrite of the WoWLAN wakeup packet pattern Date: Tue, 5 Apr 2022 09:29:19 +0200 Message-Id: <20220405070306.724494034@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070258.802373272@linuxfoundation.org> References: <20220405070258.802373272@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Gong [ Upstream commit e3fb3d4418fce5484dfe7995fcd94c18b10a431a ] In function ath10k_wow_convert_8023_to_80211(), it will do memcpy for the new->pattern, and currently the new->pattern and new->mask is same with the old, then the memcpy of new->pattern will also overwrite the old->pattern, because the header format of new->pattern is 802.11, its length is larger than the old->pattern which is 802.3. Then the operation of "Copy frame body" will copy a mistake value because the body memory has been overwrite when memcpy the new->pattern. Assign another empty value to new_pattern to avoid the overwrite issue. Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049 Fixes: fa3440fa2fa1 ("ath10k: convert wow pattern from 802.3 to 802.11") Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211222031347.25463-1-quic_wgong@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/wow.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/wow.c b/drivers/net/wireless/ath/ath10k/wow.c index 7d65c115669f..20b9aa8ddf7d 100644 --- a/drivers/net/wireless/ath/ath10k/wow.c +++ b/drivers/net/wireless/ath/ath10k/wow.c @@ -337,14 +337,15 @@ static int ath10k_vif_wow_set_wakeups(struct ath10k_vif *arvif, if (patterns[i].mask[j / 8] & BIT(j % 8)) bitmask[j] = 0xff; old_pattern.mask = bitmask; - new_pattern = old_pattern; if (ar->wmi.rx_decap_mode == ATH10K_HW_TXRX_NATIVE_WIFI) { - if (patterns[i].pkt_offset < ETH_HLEN) + if (patterns[i].pkt_offset < ETH_HLEN) { ath10k_wow_convert_8023_to_80211(&new_pattern, &old_pattern); - else + } else { + new_pattern = old_pattern; new_pattern.pkt_offset += WOW_HDR_LEN - ETH_HLEN; + } } if (WARN_ON(new_pattern.pattern_len > WOW_MAX_PATTERN_SIZE)) -- 2.34.1