wifi: iwlwifi: mvm: don't set replay counters to 0xff
authorJohannes Berg <johannes.berg@intel.com>
Tue, 6 Feb 2024 16:02:09 +0000 (18:02 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 8 Feb 2024 14:00:48 +0000 (15:00 +0100)
The firmware (later) actually uses the values even for keys
that are invalid as far as the host is concerned, later in
rekeying, and then only sets the low 48 bits since the PNs
are only 48 bits over the air. It does, however, compare the
full 64 bits later, obviously causing problems.

Remove the memset and use kzalloc instead to avoid any old
heap data leaking to the firmware. We already init all the
other fields in the struct anyway. This leaves the data set
to zero for any unused fields, so the firmware can look at
them safely even if they're not used right now.

Fixes: 79e561f0f05a ("iwlwifi: mvm: d3: implement RSC command version 5")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240206175739.462101146fef.I10f3855b99417af4247cff04af78dcbc6cb75c9c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/d3.c

index 5bc08c1d207a1c331fd0096b6c996a37d18e17f4..e1c77276557d2f341cacdc0660ff570c02b7bc03 100644 (file)
@@ -461,12 +461,10 @@ static int iwl_mvm_wowlan_config_rsc_tsc(struct iwl_mvm *mvm,
                struct wowlan_key_rsc_v5_data data = {};
                int i;
 
-               data.rsc = kmalloc(sizeof(*data.rsc), GFP_KERNEL);
+               data.rsc = kzalloc(sizeof(*data.rsc), GFP_KERNEL);
                if (!data.rsc)
                        return -ENOMEM;
 
-               memset(data.rsc, 0xff, sizeof(*data.rsc));
-
                for (i = 0; i < ARRAY_SIZE(data.rsc->mcast_key_id_map); i++)
                        data.rsc->mcast_key_id_map[i] =
                                IWL_MCAST_KEY_MAP_INVALID;