From patchwork Wed Oct 19 08:26:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5462 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp331511wrs; Wed, 19 Oct 2022 06:36:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+IwOmbkwLL+vHtDiIDW11KNhT/WHmh7iMYkGnPmWwHxqGUl5uDA2xIB2IzRW2Unp3F85W X-Received: by 2002:a65:590f:0:b0:46b:1a7b:a7d3 with SMTP id f15-20020a65590f000000b0046b1a7ba7d3mr7521628pgu.136.1666186617774; Wed, 19 Oct 2022 06:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186617; cv=none; d=google.com; s=arc-20160816; b=MYxPKqE7PBJvWGUfvNQlCTFU0vQGoenXe/qN5Ev0Pt9tjUs5DOgUsQsx8+Fy1yNZZG 01NidihEJL3eY2iSw2Kl5SWhJ+XZUxsBkfCVXCffh2flPVdC4/d12Btp/x7wNnLpZrvr JD3tvzlWkGBsXFLGx3QtJHGiii1DYEfyxz5lI7IVrVhdJ/r0rzfoYQ/uBthvZe0+DrBJ gdcNowraNJoYe4VxiEOswcZ7WkfoaIRbZlkQ8OB5m4X/sLJJfAjjvlnwPS4mw/y1m7ni +VtoNOw8t1DNna01+h8qAD4gRdP//77G4EJErlQ2ZK9/WoXnrBx2npw0klEvuOzr998V BZrA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m8-20020a170902f64800b00179d9679ad0si18352510plg.190.2022.10.19.06.36.44; Wed, 19 Oct 2022 06:36:57 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747123298731303740?= X-GMAIL-MSGID: =?utf-8?q?1747123298731303740?= 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; }