hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/wireless/intel/iwlwifi/dvm/sta.c
....@@ -1,25 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /******************************************************************************
23 *
34 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
45 *
56 * Portions of this file are derived from the ipw3945 project, as well
67 * as portions of the ieee80211 subsystem header files.
7
- *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms of version 2 of the GNU General Public License as
10
- * published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15
- * more details.
16
- *
17
- * You should have received a copy of the GNU General Public License along with
18
- * this program; if not, write to the Free Software Foundation, Inc.,
19
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
20
- *
21
- * The full GNU General Public License is included in this distribution in the
22
- * file called LICENSE.
238 *
249 * Contact Information:
2510 * Intel Linux Wireless <linuxwifi@intel.com>
....@@ -249,7 +234,7 @@
249234 priv->stations[index].sta.station_flags |= flags;
250235 }
251236
252
-/**
237
+/*
253238 * iwl_prep_station - Prepare station information for addition
254239 *
255240 * should be called with sta_lock held
....@@ -338,7 +323,7 @@
338323
339324 #define STA_WAIT_TIMEOUT (HZ/2)
340325
341
-/**
326
+/*
342327 * iwl_add_station_common -
343328 */
344329 int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
....@@ -398,7 +383,7 @@
398383 return ret;
399384 }
400385
401
-/**
386
+/*
402387 * iwl_sta_ucode_deactivate - deactivate ucode status for a station
403388 */
404389 static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id)
....@@ -466,7 +451,7 @@
466451 return ret;
467452 }
468453
469
-/**
454
+/*
470455 * iwl_remove_station - Remove driver's knowledge of station.
471456 */
472457 int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id,
....@@ -616,7 +601,7 @@
616601 link_cmd->sta_id = sta_id;
617602 }
618603
619
-/**
604
+/*
620605 * iwl_clear_ucode_stations - clear ucode station table bits
621606 *
622607 * This function clears all the bits in the driver indicating
....@@ -651,7 +636,7 @@
651636 "No active stations found to be cleared\n");
652637 }
653638
654
-/**
639
+/*
655640 * iwl_restore_stations() - Restore driver known stations to device
656641 *
657642 * All stations considered active by driver, but not present in ucode, is
....@@ -788,7 +773,7 @@
788773 }
789774 #endif
790775
791
-/**
776
+/*
792777 * is_lq_table_valid() - Test one aspect of LQ cmd for validity
793778 *
794779 * It sometimes happens when a HT rate has been in use and we
....@@ -822,7 +807,7 @@
822807 return true;
823808 }
824809
825
-/**
810
+/*
826811 * iwl_send_lq_cmd() - Send link quality command
827812 * @init: This command is sent as part of station initialization right
828813 * after station has been added.
....@@ -1101,6 +1086,7 @@
11011086 {
11021087 __le16 key_flags;
11031088 struct iwl_addsta_cmd sta_cmd;
1089
+ size_t to_copy;
11041090 int i;
11051091
11061092 spin_lock_bh(&priv->sta_lock);
....@@ -1120,7 +1106,9 @@
11201106 sta_cmd.key.tkip_rx_tsc_byte2 = tkip_iv32;
11211107 for (i = 0; i < 5; i++)
11221108 sta_cmd.key.tkip_rx_ttak[i] = cpu_to_le16(tkip_p1k[i]);
1123
- memcpy(sta_cmd.key.key, keyconf->key, keyconf->keylen);
1109
+ /* keyconf may contain MIC rx/tx keys which iwl does not use */
1110
+ to_copy = min_t(size_t, sizeof(sta_cmd.key.key), keyconf->keylen);
1111
+ memcpy(sta_cmd.key.key, keyconf->key, to_copy);
11241112 break;
11251113 case WLAN_CIPHER_SUITE_WEP104:
11261114 key_flags |= STA_KEY_FLG_KEY_SIZE_MSK;
....@@ -1273,7 +1261,7 @@
12731261 return ret;
12741262 }
12751263
1276
-/**
1264
+/*
12771265 * iwlagn_alloc_bcast_station - add broadcast station into driver's station table.
12781266 *
12791267 * This adds the broadcast station into the driver's station table
....@@ -1313,7 +1301,7 @@
13131301 return 0;
13141302 }
13151303
1316
-/**
1304
+/*
13171305 * iwl_update_bcast_station - update broadcast station's LQ command
13181306 *
13191307 * Only used by iwlagn. Placed here to have all bcast station management
....@@ -1356,7 +1344,7 @@
13561344 return ret;
13571345 }
13581346
1359
-/**
1347
+/*
13601348 * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table
13611349 */
13621350 int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid)