mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zeshan Ahmed Nobin <zeshanahmednobin@gmail.com>
To: Luka Gejak <luka.gejak@linux.dev>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ping-Ke Shih <pkshih@realtek.com>, Kalle Valo <kvalo@kernel.org>
Subject: Re: [PATCH RESEND rtw-next v2 1/2] wifi: rtw88: 8822c: fix out-of-bounds access in cck_pd_set
Date: Tue, 10 Nov 2026 00:20:01 +0600	[thread overview]
Message-ID: <20261109182001.29076-1-zeshanahmednobin@gmail.com> (raw)
In-Reply-To: <0FD97102-7E9C-47DA-9B52-7F7A837E2924@linux.dev>

Hi Luka,

On Mon, Nov 09, 2026 at 07:41:46 +0100, Luka Gejak wrote:
> As far as I can see bw doesn't have to come from the chip here, since
> rtw_set_channel() programs the same value it stores in hal. So maybe
> this could just be
>
>         bw = rtwdev->hal.current_band_width;
>
> CCK PD only runs on 2.4 GHz, so that seems to always be 20 or 40 MHz and
> the check could go. Or is there a reason to read it from the chip that I
> missed?

I couldn't find one. Apart from the BB init table, bits 3:2 of 0x9b0
are only written by rtw8822c_set_channel_bb(), with the bandwidth that
rtw_set_channel() also stores in hal. I also checked it on my
RTL8822CE with Ubuntu's 6.8 kernel. Its firmware does hardware scans,
and at 40 MHz on 2.4 GHz, hal and the register matched at every
cck_pd_set call, across 10 scans and a reconnect. So v3 will take bw
from hal and drop the check.

One consequence: a chip that drops off the PCIe bus still reads nrx
back as 3. When the level then changes, rtw8822c_phy_cck_pd_set_reg()
gets past its WARN_ON(), since bw is now valid, and does the zero-mask
access to register 0x0; forcing nrx to 3 confirmed it. So on PCIe,
patch 2 is then what handles a dead chip. In v3 I'll update its
message for that and add Cc: stable to it as well. Its code doesn't
change; is it fine to keep your Reviewed-by on it?

Thanks,
Zeshan Ahmed Nobin

  reply	other threads:[~2026-11-09 18:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08 18:28 [PATCH RESEND rtw-next v2 0/2] wifi: rtw88: 8822c: check register values " Zeshan Ahmed Nobin
2026-11-08 18:28 ` [PATCH RESEND rtw-next v2 1/2] wifi: rtw88: 8822c: fix out-of-bounds access " Zeshan Ahmed Nobin
2026-11-09  6:41   ` Luka Gejak
2026-11-09 18:20     ` Zeshan Ahmed Nobin [this message]
2026-11-09 19:24       ` Luka Gejak
2026-11-08 18:28 ` [PATCH RESEND rtw-next v2 2/2] wifi: rtw88: 8822c: ignore nrx values without CCK PD registers Zeshan Ahmed Nobin
2026-11-09  6:43   ` Luka Gejak

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=20261109182001.29076-1-zeshanahmednobin@gmail.com \
    --to=zeshanahmednobin@gmail.com \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luka.gejak@linux.dev \
    --cc=pkshih@realtek.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®