Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3921573rwi; Sat, 22 Oct 2022 02:15:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uvHSbzqyrADNfEZaQCtEl4/KnXOpOl8Tp8DjXm0Gh8gDcDz0bHqOQ8oMdFREBMxOM/QQr X-Received: by 2002:a17:903:245:b0:178:e0ba:e507 with SMTP id j5-20020a170903024500b00178e0bae507mr24020279plh.115.1666430107013; Sat, 22 Oct 2022 02:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430107; cv=none; d=google.com; s=arc-20160816; b=bPHNq2OzZVeOZSuK+m/PULtuMO2gr4mixzSxFxQ0vVYg4DNfrPOOo96aKvIhgl3qeW HbKNjiJ2nPVYEZ/W2NIYLukoJAA4J/h+zZhv8V1le0MbX22O8Ef1n+0rBETdJ/ttox1C HxQEORO8yKiKOAV39y2M1gakrYMofI0QUwbcNu1W4IUwosH60a5EmIyuPDwdaWXZ/ww3 omSA1iVBlnefcUQ2ZbPqUroNBeIwYvbfSCIBQOyfvsfqwJg8fFlxUNcAOWhpM29rPB7O VB1YGMkkO2AkVFOjYsmHWgYIwrRfifpvczLZXAVVpGzs09lVoi9GbRi3WQdnXTs4rw/n +QBQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t26-20020a63535a000000b0045ce0eba52esi30004146pgl.114.2022.10.22.02.14.55; Sat, 22 Oct 2022 02:15:07 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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; } -- 2.35.1