From patchwork Sat Oct 22 07:22:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7376 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096558wrr; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cNODpIoOPUW3B4BLiBakb7TnToaHmf/vVggfpqVbW2KlWpIMzTUy+n1xoQr7oLb6ewULd X-Received: by 2002:a17:90b:1e11:b0:20d:90b3:45a0 with SMTP id pg17-20020a17090b1e1100b0020d90b345a0mr59363992pjb.29.1666425926305; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425926; cv=none; d=google.com; s=arc-20160816; b=z1KMFvGAvzDOn+z+rfKspO6VD22w5rRJH3d0zr/xGYfCvmmXK9Q4hp2p2QfAP8oZad 2zQ8aPeNJEbOjQDAUiCoKa/+1+VmC23VGSnT3Pc8E5/EVPx+jhfNiRQqQFch9FemYAA6 /6b3TNLewV8g7JKKV0GfHIb3uXJivylvOb47BIPt3waB4NrLYijpUhMBp2/jgYlTkWLa vCPx+XmnViag4SCHK0EGYcOGSOS7dyx0MqahmHLrPoM/K/rtAqj2MkVv38XpPcmPt0ot AED/tiTyYotV6q+2bzbndQm3XYshHzoESIafTCc3GFIwgeKn0M8EruBxLF4Gz4VtVMQ7 RhAg== 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=fApmytazUCHANFuc/R6fe98LwtXJhaMJIw/lWr/NfCc=; b=DFlaAWJNIIKmvPcU4sohjVjOS+y3NqLv3IkFGgVmYNo5UGl4OUNjyQYf4eP8/uds0C Z9bd4YfbIQXnOPD9vgWfjNWm2mTaCqTuvDyg0duQXUQZU5Acb2BaG5YBHbWioICZgD3M OG9+Y+nklEHrzW84pIwd+GSfoj0ta9wrzmlIbifVwJEKSHGdMzN43kfHhoAf4J8saSDI q3LFRTZx+X9m88dB7V8/fK1/KEOWf7AS4N9lKlWBAn9gzbwDOl3bdmkTkU5LP7MVePHT xVChHnMtsdCoNpZTCLKajMh5ArIXcw8hoRpPAFG86vO86Gh+TNPrkfEo7F3XcMDzU1r0 I26w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pLj/n9x+"; 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 f16-20020a63f110000000b0045fd05b2ce9si25838393pgi.521.2022.10.22.01.05.12; Sat, 22 Oct 2022 01:05:26 -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="pLj/n9x+"; 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 S232676AbiJVIDt (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232236AbiJVH4s (ORCPT ); Sat, 22 Oct 2022 03:56:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DF9B13A588; Sat, 22 Oct 2022 00:48:32 -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 7CE46B82E1C; Sat, 22 Oct 2022 07:45:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAEB6C433D6; Sat, 22 Oct 2022 07:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424703; bh=uKCPqX8as8dkL2IZatNJrSMA6N4n2ERN4NedPly5oI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pLj/n9x+1oXu3a0Y04YtrIcDspxFKhopJfhpAo6Ch4Rk8AWovujNElDmJ4HaxzpAT d6WxaYg5cLRfKtv4XxAeqO1PM/+ebMpMqjtKrAPY0WuyYhEmtp1NpHb/KadacCaFMK VmVQPnXfBUNoYeJ+K8O2zT0igvz6sVHsL8Ii0SFg= 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 5.19 245/717] wifi: mt76: connac: fix possible unaligned access in mt76_connac_mcu_add_nested_tlv Date: Sat, 22 Oct 2022 09:22:04 +0200 Message-Id: <20221022072458.267489976@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374232126632361?= X-GMAIL-MSGID: =?utf-8?q?1747374232126632361?= 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 7eb23805aa94..d10b441eac4f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -258,8 +258,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; }