Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9112457pxu; Mon, 28 Dec 2020 06:58:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8YzPpFOqfCHod88cwHA9TJUH/sBdG22aLHb/S5/o/WHc8/G3we20eA+Ect2gVqEopC7nB X-Received: by 2002:a17:906:6606:: with SMTP id b6mr40995533ejp.151.1609167539633; Mon, 28 Dec 2020 06:58:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609167539; cv=none; d=google.com; s=arc-20160816; b=OhuSe8WehLUGKGGVx+2t05fpCCZ7DBL2eVBKqeu6FXsyaHhfoSUN9sRzZ99h9wk9qt +RwmzuoAbnbJMZauqaGg/kuJfI4wRkirzdbEZ7weWkt+m+wuVlBOp+zrXZwIHenSVxdf l5XozhCH+ZUppOvFOp1zdeeETcQ0aDFyRCvS+61QC/rxtKTtjMEl2UVxcK1QpfZCAX+o f11YsgRTs/qG9YgKUeWKj+G1EhltkQ4bVd474+bqxE0P8Gm0dD4yALcrgs9JMksFRhiX ICXs93M2OkSN7Za4T5VcCEsDN0kg8tnOValEYH54Qe3bhNYEcrLmz15pqZdQuTvmOeL+ jCBg== 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=hHXMpXjpJXmZCaQzVLgPmzA4rKMNnQRfLZAqfp5MrhY=; b=DLyxikcuGslO5iKxwWswo8ie3UTHrr9yCKwB7HANLcKs/3+cwDgs5IHGzOrUQHJ/ea 6CRHLkpX2fWYMEZ50dPcMbL1M2v1FCIAREHShx+Qpjg2Lb2ue7mOnH2+oswep63d/ALB BqAmDxrw0RIKa1bcHqA9C17BFm+nk6T8lOXIxpcdfW02Az5VxKU9FnhtdUut0UDdYU69 9p0NNTLaOaffab9cHklkqhfsi4v2CbBNQtjnRUiBVMeI4eARFObKgllgJIlMfE1hogI4 vV6dmv+2JYvgmiLQFT0K2FW7LyzwPBSeHSAT8dqB4q5jSQ8QkN7Wl7egw6u4E+mE5Nyw 5Wcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZUPrOMRq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k17si18270331ejc.181.2020.12.28.06.58.34; Mon, 28 Dec 2020 06:58:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZUPrOMRq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2440758AbgL1OQx (ORCPT + 99 others); Mon, 28 Dec 2020 09:16:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:51220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440944AbgL1OQK (ORCPT ); Mon, 28 Dec 2020 09:16:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C0EB22583; Mon, 28 Dec 2020 14:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164930; bh=9PRscArJdIz080d3J4yv/u/iu37fCnpUoJZKn9l/q1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZUPrOMRqL7kpaOjV7mBnLdH8JEWHAPz73bFT0ErKIF858htFZrOjZ4dRHWtDoWkGK FlzLRViTdnzxZrWFpvaby8RRi4MClqjl0IyktsB7GhTt7if/7oNqh6nxOsfX8YfAqo IW+AAzy0X4p6aHJ9Ko6+QrbN2nRYHLdygdo/LS9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.10 308/717] mt76: fix tkip configuration for mt7615/7663 devices Date: Mon, 28 Dec 2020 13:45:06 +0100 Message-Id: <20201228125035.784546506@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenzo Bianconi [ Upstream commit 930e0eaddf810cfa90e114a0df02f48539e1346f ] Fix Tx-Rx MIC overwrite during TKIP hw key configuration Fixes: 01cfc1b45421 ("mt76: mt7615: add BIP_CMAC_128 cipher support") Tested-by: YN Chen Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 8dc645e398fda..3d62fda067e44 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -1046,15 +1046,17 @@ int mt7615_mac_wtbl_update_key(struct mt7615_dev *dev, if (cmd == SET_KEY) { if (cipher == MT_CIPHER_TKIP) { /* Rx/Tx MIC keys are swapped */ + memcpy(data, key, 16); memcpy(data + 16, key + 24, 8); memcpy(data + 24, key + 16, 8); + } else { + if (cipher != MT_CIPHER_BIP_CMAC_128 && wcid->cipher) + memmove(data + 16, data, 16); + if (cipher != MT_CIPHER_BIP_CMAC_128 || !wcid->cipher) + memcpy(data, key, keylen); + else if (cipher == MT_CIPHER_BIP_CMAC_128) + memcpy(data + 16, key, 16); } - if (cipher != MT_CIPHER_BIP_CMAC_128 && wcid->cipher) - memmove(data + 16, data, 16); - if (cipher != MT_CIPHER_BIP_CMAC_128 || !wcid->cipher) - memcpy(data, key, keylen); - else if (cipher == MT_CIPHER_BIP_CMAC_128) - memcpy(data + 16, key, 16); } else { if (wcid->cipher & ~BIT(cipher)) { if (cipher != MT_CIPHER_BIP_CMAC_128) -- 2.27.0