All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: イムティヤズ <reza1234khan1234@gmail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: "stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH] wifi: rtw88: fix out-of-bounds CAM write when key table is full
Date: Mon, 10 Aug 2026 03:17:50 +0000	[thread overview]
Message-ID: <253cd5376c6346c893b5a88b32215b23@realtek.com> (raw)
In-Reply-To: <20260805210941.75136-1-reza1234khan1234@gmail.com>


イムティヤズ <reza1234khan1234@gmail.com> wrote:
> In rtw_ops_set_key(), when the CAM table is full,
> rtw_sec_get_free_cam() returns RTW_MAX_SEC_CAM_NUM (32) because
> find_next_zero_bit()/find_first_zero_bit() return the bitmap size
> when no free slot exists. The bounds check compares the returned
> index with ">" against total_cam_num (32), so the invalid index 32
> passes the check.
> 
> rtw_sec_write_cam() then indexes cam_table[32], an array declared
> with RTW_MAX_SEC_CAM_NUM (32) entries, causing an out-of-bounds
> write that corrupts the cam_map allocation bitmap. The write also
> sets bit 32 of cam_map, which overruns the bitmap as well.
> 
> Fix the off-by-one by rejecting indices >= total_cam_num.
> 
> Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
> Cc: stable@vger.kernel.org

These two are formal tags, so I'd move them together with Tested-by tag.

> 
> Tested on: RTL8821CE (PCIe) on kernel
> 7.2.0-rc6-rtw88test-00059-g0d8395707651. The patched module loaded
> and associated to a WPA2 network; ping traffic passed with 0% packet
> loss. Reassociation and disconnect/reconnect cycles completed
> without errors, and the CAM table (debugfs dump_cam) showed valid
> key entries. The CAM-full boundary (28+ pairwise keys) requires an
> access point with 28+ clients and is not reachable in a
> single-client setup, so that path was verified by code inspection.

Yes. Unless you start an AP mode, and use many clients connect it, but
I suspect rtw88 can't afford to support such clients. 

> 
> Tested-by: イムティヤズ <reza1234khan1234@gmail.com>
> Signed-off-by: イムティヤズ <reza1234khan1234@gmail.com>

By the way, if you want spell your Japanese name in English, the display would
be normal since my some git tools do not support UTF-8. But I don't insist this.

Acked-by: Ping-Ke Shih <pkshih@realtek.com>



      reply	other threads:[~2026-08-10  3:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 21:09 [PATCH] wifi: rtw88: fix out-of-bounds CAM write when key table is full イムティヤズ
2026-08-10  3:17 ` Ping-Ke Shih [this message]

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=253cd5376c6346c893b5a88b32215b23@realtek.com \
    --to=pkshih@realtek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=reza1234khan1234@gmail.com \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.