From: Hungyu Lin <dennylin0707@gmail.com>
To: pkshih@realtek.com
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
reza1234khan1234@gmail.com, Hungyu Lin <dennylin0707@gmail.com>
Subject: [PATCH] wifi: rtw88: allow key removal when the CAM table is full
Date: Mon, 19 Oct 2026 16:51:03 +0000 [thread overview]
Message-ID: <20261019165103.5990-1-dennylin0707@gmail.com> (raw)
rtw_ops_set_key() looks for a free CAM entry before checking the
command. When all pairwise entries are in use, DISABLE_KEY returns
-ENOSPC without clearing the existing entry.
Move the allocation and bounds check into SET_KEY. DISABLE_KEY uses
the existing key->hw_key_idx.
Fixes: 10d58823cb44 ("wifi: rtw88: fix out-of-bounds CAM write when key table is full")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
drivers/net/wireless/realtek/rtw88/mac80211.c | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
index 2a9b09fa76e7..5e40cf06a9e3 100644
--- a/drivers/net/wireless/realtek/rtw88/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
@@ -598,20 +598,20 @@ static int rtw_ops_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
rtw_leave_lps_deep(rtwdev);
- if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
- hw_key_idx = rtw_sec_get_free_cam(sec);
- } else {
- /* multiple interfaces? */
- hw_key_idx = key->keyidx;
- }
-
- if (hw_key_idx >= sec->total_cam_num) {
- ret = -ENOSPC;
- goto out;
- }
-
switch (cmd) {
case SET_KEY:
+ if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
+ hw_key_idx = rtw_sec_get_free_cam(sec);
+ } else {
+ /* multiple interfaces? */
+ hw_key_idx = key->keyidx;
+ }
+
+ if (hw_key_idx >= sec->total_cam_num) {
+ ret = -ENOSPC;
+ goto out;
+ }
+
/* need sw generated IV */
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
key->hw_key_idx = hw_key_idx;
next reply other threads:[~2026-10-19 17:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 16:51 Hungyu Lin [this message]
2026-10-19 19:01 ` [PATCH] wifi: rtw88: allow key removal when the CAM table is full Luka Gejak
2026-10-20 2:07 ` Ping-Ke Shih
2026-10-20 4:43 ` Luka Gejak
2026-10-20 5:29 ` Ping-Ke Shih
2026-10-20 8:28 ` Hungyu Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261019165103.5990-1-dennylin0707@gmail.com \
--to=dennylin0707@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=reza1234khan1234@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox