mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
wifi: rsi: avoid reading TKIP MIC keys for non-TKIP ciphers
rsi_hal_load_key() copies tx_mic_key and rx_mic_key from data[16] and data[24] whenever key data is present. Those offsets are only part of the 32-byte TKIP key layout. Shorter keys used by other ciphers, such as CCMP, do not provide those bytes, so the unconditional copies can read past the supplied key buffer. Only copy the MIC keys for TKIP, and reject malformed TKIP keys that are shorter than the expected 32-byte layout. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Link: https://patch.msgid.link/20260701053414.34015-1-pengpeng@iscas.ac.cn [drop useless length check] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
ebd6d37fa9
commit
843fe9bc58
|
|
@ -848,8 +848,10 @@ int rsi_hal_load_key(struct rsi_common *common,
|
|||
} else {
|
||||
memcpy(&set_key->key[0][0], data, key_len);
|
||||
}
|
||||
memcpy(set_key->tx_mic_key, &data[16], 8);
|
||||
memcpy(set_key->rx_mic_key, &data[24], 8);
|
||||
if (cipher == WLAN_CIPHER_SUITE_TKIP) {
|
||||
memcpy(set_key->tx_mic_key, &data[16], 8);
|
||||
memcpy(set_key->rx_mic_key, &data[24], 8);
|
||||
}
|
||||
} else {
|
||||
memset(&set_key[FRAME_DESC_SZ], 0, frame_len - FRAME_DESC_SZ);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user