1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/wireless/intel/iwlwifi/dvm
Hans de Goede ef16799640 wifi: iwlwifi: dvm: Fix memcpy: detected field-spanning write backtrace
A received TKIP key may be up to 32 bytes because it may contain
MIC rx/tx keys too. These are not used by iwl and copying these
over overflows the iwl_keyinfo.key field.

Add a check to not copy more data to iwl_keyinfo.key then will fit.

This fixes backtraces like this one:

 memcpy: detected field-spanning write (size 32) of single field "sta_cmd.key.key" at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 (size 16)
 WARNING: CPU: 1 PID: 946 at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 iwlagn_send_sta_key+0x375/0x390 [iwldvm]
 <snip>
 Hardware name: Dell Inc. Latitude E6430/0H3MT5, BIOS A21 05/08/2017
 RIP: 0010:iwlagn_send_sta_key+0x375/0x390 [iwldvm]
 <snip>
 Call Trace:
  <TASK>
  iwl_set_dynamic_key+0x1f0/0x220 [iwldvm]
  iwlagn_mac_set_key+0x1e4/0x280 [iwldvm]
  drv_set_key+0xa4/0x1b0 [mac80211]
  ieee80211_key_enable_hw_accel+0xa8/0x2d0 [mac80211]
  ieee80211_key_replace+0x22d/0x8e0 [mac80211]
 <snip>

Link: https://www.alionet.org/index.php?topic=1469.0
Link: https://lore.kernel.org/linux-wireless/20230218191056.never.374-kees@kernel.org/
Link: https://lore.kernel.org/linux-wireless/68760035-7f75-1b23-e355-bfb758a87d83@redhat.com/
Cc: Kees Cook <keescook@chromium.org>
Suggested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-04-19 09:42:28 +02:00
..
agn.h wifi: iwlwifi: calib: Refactor iwl_calib_result usage for clarity 2022-09-07 10:16:27 +03:00
calib.c wifi: iwlwifi: calib: Refactor iwl_calib_result usage for clarity 2022-09-07 10:16:27 +03:00
calib.h iwlwifi: use SPDX tags 2020-12-10 00:15:31 +02:00
commands.h treewide: Replace open-coded flex arrays in unions 2021-10-18 12:28:53 -07:00
debugfs.c iwlwifi: remove contact information 2021-10-22 10:48:59 +03:00
dev.h wifi: iwlwifi: Track scan_cmd allocation size explicitly 2022-09-28 09:43:58 +03:00
devices.c iwlwifi: remove contact information 2021-10-22 10:48:59 +03:00
led.c iwlwifi: remove contact information 2021-10-22 10:48:59 +03:00
led.h iwlwifi: remove contact information 2021-10-22 10:48:59 +03:00
lib.c wifi: mac80211: make some SMPS code MLD-aware 2022-06-20 12:55:30 +02:00
mac80211.c wifi: mac80211: add wake_tx_queue callback to drivers 2022-10-10 11:00:03 +02:00
main.c wifi: mac80211: return a beacon for a specific link 2022-06-20 12:57:08 +02:00
Makefile wireless: prefix header search paths with $(srctree)/ 2019-02-01 14:42:25 +02:00
power.c iwlwifi: remove contact information 2021-10-22 10:48:59 +03:00
power.h iwlwifi: remove contact information 2021-10-22 10:48:59 +03:00
rs.c wifi: mac80211: make smps_mode per-link 2022-09-06 10:11:44 +02:00
rs.h iwlwifi: remove contact information 2021-10-22 10:48:59 +03:00
rx.c iwlwifi: dvm: use struct_size over open coded arithmetic 2022-02-18 10:40:55 +02:00
rxon.c wifi: mac80211: return a beacon for a specific link 2022-06-20 12:57:08 +02:00
scan.c wifi: iwlwifi: Track scan_cmd allocation size explicitly 2022-09-28 09:43:58 +03:00
sta.c wifi: iwlwifi: dvm: Fix memcpy: detected field-spanning write backtrace 2023-04-19 09:42:28 +02:00
tt.c iwlwifi: remove contact information 2021-10-22 10:48:59 +03:00
tt.h iwlwifi: remove contact information 2021-10-22 10:48:59 +03:00
tx.c iwlwifi: remove contact information 2021-10-22 10:48:59 +03:00
ucode.c wifi: iwlwifi: calib: Refactor iwl_calib_result usage for clarity 2022-09-07 10:16:27 +03:00