ath: Use safer key clearing with key cache entries
authorJouni Malinen <jouni@codeaurora.org>
Mon, 14 Dec 2020 17:21:14 +0000 (19:21 +0200)
committerSasha Levin <sashal@kernel.org>
Thu, 26 Aug 2021 12:37:06 +0000 (08:37 -0400)
commit2cbb22fd4b4fb4d0822d185bf5bd6d027107bfda
tree5d6fe3e88638c0d2b8265b443c92812128b757ad
parentaf3da506c67bbbf6f08f1c2bd320d7e3e5de96ef
ath: Use safer key clearing with key cache entries

commit 56c5485c9e444c2e85e11694b6c44f1338fc20fd upstream.

It is possible for there to be pending frames in TXQs with a reference
to the key cache entry that is being deleted. If such a key cache entry
is cleared, those pending frame in TXQ might get transmitted without
proper encryption. It is safer to leave the previously used key into the
key cache in such cases. Instead, only clear the MAC address to prevent
RX processing from using this key cache entry.

This is needed in particularly in AP mode where the TXQs cannot be
flushed on station disconnection. This change alone may not be able to
address all cases where the key cache entry might get reused for other
purposes immediately (the key cache entry should be released for reuse
only once the TXQs do not have any remaining references to them), but
this makes it less likely to get unprotected frames and the more
complete changes may end up being significantly more complex.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201214172118.18100-2-jouni@codeaurora.org
Cc: Pali Rohár <pali@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/ath/key.c