All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
	Johannes Berg <johannes.berg@intel.com>,
	Gregory Greenman <gregory.greenman@intel.com>
Subject: [PATCH 03/15] wifi: iwlwifi: mvm: d3: fix IPN byte order
Date: Mon, 29 Jan 2024 21:21:51 +0200	[thread overview]
Message-ID: <20240129211905.138ed8a698e3.I1b66c386e45b5392696424ec636474bff86fd5ef@changeid> (raw)
In-Reply-To: <20240129192203.4189915-1-miriam.rachel.korenblit@intel.com>

From: Johannes Berg <johannes.berg@intel.com>

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 <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 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 61aeb7f6604b..6ab9def2c670 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -2194,7 +2194,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;
@@ -2206,7 +2209,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.34.1


  parent reply	other threads:[~2024-01-29 19:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 19:21 [PATCH 00/15] wifi: iwlwifi: updates - 2024-01-29 Miri Korenblit
2024-01-29 19:21 ` [PATCH 01/15] wifi: iwlwifi: fix EWRD table validity check Miri Korenblit
2024-01-29 19:21 ` [PATCH 02/15] wifi: iwlwifi: mvm: add support for TID to link mapping neg request Miri Korenblit
2024-01-29 19:21 ` Miri Korenblit [this message]
2024-01-29 19:21 ` [PATCH 04/15] wifi: iwlwifi: Fix spelling mistake "SESION" -> "SESSION" Miri Korenblit
2024-01-29 19:21 ` [PATCH 05/15] wifi: iwlwifi: mvm: don't set trigger frame padding in AP mode Miri Korenblit
2024-01-29 19:21 ` [PATCH 06/15] wifi: iwlwifi: always have 'uats_enabled' Miri Korenblit
2024-01-29 19:21 ` [PATCH 07/15] wifi: iwlwifi: mvm: Fix FTM initiator flags Miri Korenblit
2024-01-29 19:21 ` [PATCH 08/15] wifi: iwlwifi: mvm: Add support for removing responder TKs Miri Korenblit
2024-01-29 19:21 ` [PATCH 09/15] wifi: iwlwifi: remove Gl A-step remnants Miri Korenblit
2024-01-29 19:21 ` [PATCH 10/15] wifi: iwlwifi: mvm: use FW rate for non-data only on new devices Miri Korenblit
2024-01-29 19:21 ` [PATCH 11/15] wifi: iwlwifi: mvm: fix the TLC command after ADD_STA Miri Korenblit
2024-01-29 19:22 ` [PATCH 12/15] wifi: iwlwifi: pcie: Add the PCI device id for new hardware Miri Korenblit
2024-01-29 19:22 ` [PATCH 13/15] wifi: iwlwifi: mvm: support SPP A-MSDUs Miri Korenblit
2024-01-29 19:22 ` [PATCH 14/15] wifi: iwlwifi: mvm: log dropped packets due to MIC error Miri Korenblit
2024-01-29 19:22 ` [PATCH 15/15] wifi: iwlwifi: mvm: refactor duplicate chanctx condition Miri Korenblit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240129211905.138ed8a698e3.I1b66c386e45b5392696424ec636474bff86fd5ef@changeid \
    --to=miriam.rachel.korenblit@intel.com \
    --cc=gregory.greenman@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.