Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2367333lqp; Sun, 24 Mar 2024 16:05:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrhhOdWnByKlwwi2qGixyHzBe/lQBxIaNJf2NKa7fFMJIh4+oVdMUQI0E35vlWrq7KYfDFqlkrgQBWhzemDp5SkbaqZtP14AcD4gsDWw== X-Google-Smtp-Source: AGHT+IFVrKc1th7KhkJY5Lou0FOV93+FRIrQvvL/VdJr2AJ0xBqFrq9hYK3j9bHducr6EV0Krcjb X-Received: by 2002:a17:902:6808:b0:1dd:a3e2:de77 with SMTP id h8-20020a170902680800b001dda3e2de77mr5609020plk.20.1711321524104; Sun, 24 Mar 2024 16:05:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711321524; cv=pass; d=google.com; s=arc-20160816; b=bJAD60x3fPp6mH2BMu0sY8fYx0OUjEdqQWOLuq4el0r9buqxVH4xYTfchXGjDRAn/7 7O/wx3sy4ciMr/+TUTG587Z4yshc9uPTIkucDsvXmKHOLlE60cpSbvW3hAXghjQIHr7l ec6OZg+9prur13wtzhghi0a2S0TbEe5K9JwJqQgsXDYdFMLAWbDfnylWqAnUrhAwSv8N owybDkcS3WfjYu2uEFq7QwPuY6AcG+I/+gghHyKI/qBvIkJVmJYTFTKZGZnl9RVUHLBY mFH2VkR2iTZzvw+iFNBfMo4j2/OyYpckwpycjJ/PTmJTiaZKjsKHBdF6QUab8tgF2OSB pmwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YCvTUmAINGarwGVlr72thhRal+ENlYgnW2Ok3UqfSx4=; fh=Fgj1SW8phZle2igeg9J2l9LylFuyg+28f5+r3I3IboA=; b=T5SbkBcXD16Jm5rillazWKqgRf0K0BiwsYwxGsvU9JQfSlNjFk4UsXYFEHmaALyS2e 2wFL/nyxwnSoh2jmr8dT1aN4wtuwsBX8muRjraNNQBa4Hh/7S3K9x6vOKR9CKnyle4aq xh/7WIWCPRa2y4Sws3bbp1cOKKCvh/1kQcXxC7CI6WUnwI0ofEzcNALqMLWRIQZr/fsY xVK+ZNaM/JAcX6ElA66MEuY+hNaFCPP1PmmdSSMjmBzzWcDNtL67rvRv3Cxa1heSVc21 TazXeh5fc4RLYvNan9KjhxUbBGKjilLZiCQZMmK/Gy80PMLEXv2tpNGROGMk8stxec7J qblg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d+kxftCP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113017-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113017-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q18-20020a170902eb9200b001e09505ad5fsi3984404plg.461.2024.03.24.16.05.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:05:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113017-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d+kxftCP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113017-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113017-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C3D26281B86 for ; Sun, 24 Mar 2024 23:05:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0214313777C; Sun, 24 Mar 2024 22:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d+kxftCP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F93B4DA19; Sun, 24 Mar 2024 22:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319828; cv=none; b=Mv9yIWagYDiqPKyAFzS77ZnnPjqUV/gN2eBZwTsF1ZSrH50ieEh4ZQ0Fck/ZZXVk6pYMk+RGpD7QcDEpM1eOj9j54LkmFIiz8gifXIoNUJQHrHwlXV1lDHMHODzqh1FNFHf4L/QnN9yBtWNYFozqZto6XmYi6MflS0UH1VYJz0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319828; c=relaxed/simple; bh=soa6+wLeSx4p3+23fyg42wBQs0Dyods3SJnIOwXqhOU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BzIgkKcQiSkX/9QPoaJRXwo8ZGI28J61IjILdmrlZiZU/YZTUsOwlqVowd4FuzGOo69hnQelwAe/Fwxg8krNqqSOFUiUqdGktMin9EVMHVxjyFsB2qwLFJNyDccXkcnD9INo+ckiJXfUTOpBbhQSs3BPRvH9LYqhp/udJZAoQ2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d+kxftCP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32325C433F1; Sun, 24 Mar 2024 22:37:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319827; bh=soa6+wLeSx4p3+23fyg42wBQs0Dyods3SJnIOwXqhOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d+kxftCPmHa7z4xRbwuP/kKSIuyFrilWnxuC3UnpawXp/bRGzU+QwfrUr+3dMHxg6 v3GREJlCfRt/SJ9y0Q48KLYH+2TiE3sf2AijFf5FgaFOMtATqCSPBdsdNZx7R61zO4 apA4iyNcNyVuB3jpY55YVXN1x8fr3ynXM+k4Zo7cXOvfQJgizjCo3Vn272k1HXfbJ2 jQjpD7KKI+YMzeakq8NQ5TspaihO131QcFyzz4z6IjNKfMJVV/86EX3DUktPpLSEIT uBbXnZ4m9rm4talft75NxOfYNvtqCm09NElTLP7cXr7GpfezcHDa/pXrIfSYiYjAWN CJmOxClLxtGAA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , Gregory Greenman , Miri Korenblit , Sasha Levin Subject: [PATCH 6.8 130/715] wifi: iwlwifi: mvm: d3: fix IPN byte order Date: Sun, 24 Mar 2024 18:25:09 -0400 Message-ID: <20240324223455.1342824-131-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Johannes Berg [ Upstream commit 0c769cb6b9f364423c255f117774c9ecd5bf23ea ] The IPN is reported by the firmware in 6 bytes little endian, but mac80211 expects big endian so it can do memcmp() on it. We used to store this as a u64 which was filled in the right way, but never used. When implementing that it's used, we changed it to just be 6 bytes, but lost the conversion. Add it back. Fixes: 04f78e242fff ("wifi: iwlwifi: mvm: Add support for IGTK in D3 resume flow") Signed-off-by: Johannes Berg Reviewed-by: Gregory Greenman Signed-off-by: Miri Korenblit Link: https://msgid.link/20240129211905.138ed8a698e3.I1b66c386e45b5392696424ec636474bff86fd5ef@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c index 05b64176859e8..03d0c9ab73fc0 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c @@ -2200,7 +2200,10 @@ static void iwl_mvm_convert_gtk_v3(struct iwl_wowlan_status_data *status, static void iwl_mvm_convert_igtk(struct iwl_wowlan_status_data *status, struct iwl_wowlan_igtk_status *data) { + int i; + BUILD_BUG_ON(sizeof(status->igtk.key) < sizeof(data->key)); + BUILD_BUG_ON(sizeof(status->igtk.ipn) != sizeof(data->ipn)); if (!data->key_len) return; @@ -2212,7 +2215,10 @@ static void iwl_mvm_convert_igtk(struct iwl_wowlan_status_data *status, + WOWLAN_IGTK_MIN_INDEX; memcpy(status->igtk.key, data->key, sizeof(data->key)); - memcpy(status->igtk.ipn, data->ipn, sizeof(data->ipn)); + + /* mac80211 expects big endian for memcmp() to work, convert */ + for (i = 0; i < sizeof(data->ipn); i++) + status->igtk.ipn[i] = data->ipn[sizeof(data->ipn) - i - 1]; } static void iwl_mvm_convert_bigtk(struct iwl_wowlan_status_data *status, -- 2.43.0