mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luka Gejak" <luka.gejak@linux.dev>
To: "Ping-Ke Shih" <pkshih@realtek.com>,
	"Hungyu Lin" <dennylin0707@gmail.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	reza1234khan1234@gmail.com
Subject: Re: [PATCH] wifi: rtw88: allow key removal when the CAM table is full
Date: Tue, 20 Oct 2026 04:43:39 +0000	[thread overview]
Message-ID: <334c6e785a5d242c6f168d57d042d63b777a242a@linux.dev> (raw)
In-Reply-To: <9bde49a2e7794e4fb6bc3ae104eef87e@realtek.com>

Hi Ping-Ke,

October 20, 2026 at 4:07 AM, "Ping-Ke Shih" <pkshih@realtek.com> wrote:

> 
> Hungyu Lin <dennylin0707@gmail.com> wrote:
> 
> > 
> > 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.
> > 
> Is this the actual case you met?
> 

From my investigation it seems reachable.

As far as I undersrand, it needs all 28 pairwise entries (4-31) in
use at once, so AP mode with 28 secured stations (31 mac_ids are
left after the AP vif), or IBSS/TDLS with as many peers. Not
reachable as a plain client. Once it is hit its pairwise
DISABLE_KEY fails, mac80211 frees the key anyway after logging
"failed to remove key", the cam_map bit is never cleared, and the
table stays full until the driver is reloaded.

I think it can be tested with two clients by temporarily setting
sec.total_cam_num = 6.

> > 
> > 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")
> > 
> Should it be ?
> 
> Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
> 

I think 10d58823cb44 is the right tag. In e3037485c68e the check was

      if (hw_key_idx > sec->total_cam_num) {

and rtw_sec_get_free_cam() returns at most RTW_MAX_SEC_CAM_NUM (32),
which equals total_cam_num, so the check never fired and DISABLE_KEY
always reached rtw_sec_clear_cam(). The bug there was the
out-of-bounds SET_KEY, which 10d58823cb44 fixed. DISABLE_KEY only
started failing once the check became ">=". This patch also does not
apply without 10d58823cb44, since its context has the ">=". Since
10d58823cb44 is tagged for stable, I think this one should carry
Cc: stable@vger.kernel.org too.

Best regards,
Luka Gejak

  reply	other threads:[~2026-10-20  4:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 16:51 Hungyu Lin
2026-10-19 19:01 ` Luka Gejak
2026-10-20  2:07 ` Ping-Ke Shih
2026-10-20  4:43   ` Luka Gejak [this message]
2026-10-20  5:29     ` Ping-Ke Shih

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=334c6e785a5d242c6f168d57d042d63b777a242a@linux.dev \
    --to=luka.gejak@linux.dev \
    --cc=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

all inboxes | Powered by JetHome®