Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1183264rwi; Wed, 19 Oct 2022 07:37:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UMdwGdY6gAqxHnJO8dKZKpu9fWWratmJWytZ5QyxavbUMrb+2PQ2GpiedcJvftm9K8woJ X-Received: by 2002:a05:6a00:16c8:b0:53b:3b9f:7283 with SMTP id l8-20020a056a0016c800b0053b3b9f7283mr8745407pfc.46.1666190266585; Wed, 19 Oct 2022 07:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666190266; cv=none; d=google.com; s=arc-20160816; b=skuLwfZMJiY4S1iga+7B3j86V45blmGtvoWsSo5E+Qw/c5p9lS32g1pTfr55Qv+pK1 bGM18dvcWuLRUcgfBRf9gvM8sSAwCSAnVe/QT65UDpJIDmTXQ0OH9HgZHxWiUKxDkZGQ gcrcOnqFgXk3pS9T4Ya659WXBS85FrC6smWyk+iXncDba/69V+qgum2SGkIkiatuZqfe P7Dp4rytlBLoxyokXK/sFVgDTfMKPssZWAP/c5iOlgU4do87WwYlmodWYO+p11aGkygG XD4qptJ6qSmwpbbNPvdsbncEdUORWf95VnTGQVFfLce3awJgnef7YV0dK43kozrsWf8v YOfg== 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=Z8ldVgMzB5lWwF/pzgLBb6mqyH3ZktNE+VkHL1gh7sY=; b=oQ+N0ldGo7ZOhmfZ0Dk/NGZ4zH5Ou12U8LuQgvWTncYokkR2iWsv0uz4K6BYHEuxtj FnV9HxYCG44V53j6hcpJ4jGLXUvK3s6cCt2nff3KPf8mdsNYrmGr3KqYSYkyhEyt7/Jc aqFX7QNJrBnMmMARQB/ANvnJc93BdSyg4aeQNtZIKDc098iNAcu1mdQbDt+JTQyCU/bX ZsV6y8r4cW9S0j28jZTzPuB8/9UbzdKJlvARRlla9S8tMgu5wcxozNzr8TmhLPjQ7+Wd sUSqk8RP9X0IlUe9qlFUjcGLAuT2oPHE4qIQOhAK5wfHG8JohDy3ICdU/9mkxfL1MyHd ec/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VWNHdvlM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x22-20020a17090aca1600b00202be8d6729si47670pjt.157.2022.10.19.07.37.34; Wed, 19 Oct 2022 07:37:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VWNHdvlM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229999AbiJSN0g (ORCPT + 99 others); Wed, 19 Oct 2022 09:26:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbiJSN0H (ORCPT ); Wed, 19 Oct 2022 09:26:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF8DD1D3A5D; Wed, 19 Oct 2022 06:12:25 -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 ams.source.kernel.org (Postfix) with ESMTPS id 279F3B8238F; Wed, 19 Oct 2022 08:51:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A43FC433D6; Wed, 19 Oct 2022 08:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169458; bh=Fe2eaMVMJuai5RAeCwO60IBS5K+pDaQ07JaRfMxVcPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VWNHdvlMI1Za/eZHibwmFmFfUgdZT/gN+Q0Rsz05135v/FdQfAC5saDVgXfByQXpX IIfP/9/3ckys/RZpxhVKRbRCQ45bz032P1IBQhGV6nVR58dM8TMux9Fy+Shqn67k5L V/EXe4LIJ7JxKbZN8r7TGS3Wd67XOjx0ufrRvHCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 285/862] wifi: mt76: connac: fix possible unaligned access in mt76_connac_mcu_add_nested_tlv Date: Wed, 19 Oct 2022 10:26:12 +0200 Message-Id: <20221019083302.600692455@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: Lorenzo Bianconi [ Upstream commit 0a4860f627f1f2b2b777f54f993de1638a79da9f ] Fix possible unaligned pointer in mt76_connac_mcu_add_nested_tlv routine. Reported-by: kernel test robot Fixes: 25702d9c55dc5 ("mt76: connac: rely on le16_add_cpu in mt76_connac_mcu_add_nested_tlv") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 9b17bd97ec09..13d4722e4186 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -260,8 +260,10 @@ mt76_connac_mcu_add_nested_tlv(struct sk_buff *skb, int tag, int len, ntlv = le16_to_cpu(ntlv_hdr->tlv_num); ntlv_hdr->tlv_num = cpu_to_le16(ntlv + 1); - if (sta_hdr) - le16_add_cpu(&sta_hdr->len, len); + if (sta_hdr) { + len += le16_to_cpu(sta_hdr->len); + sta_hdr->len = cpu_to_le16(len); + } return ptlv; } -- 2.35.1