Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Huihui Huang <hhhuang@smu.edu.sg>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Luka Gejak <luka.gejak@linux.dev>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH rtw-next v3 1/2] wifi: rtw88: drop C2H packets shorter than the C2H header
Date: Sun, 8 Nov 2026 02:31:58 +0000	[thread overview]
Message-ID: <3b5749624a53468bad7b2c0b74c74d69@realtek.com> (raw)
In-Reply-To: <20261105125958.3891196-2-hhhuang@smu.edu.sg>

Huihui Huang <hhhuang@smu.edu.sg> wrote:
> rtw_fw_c2h_cmd_rx_irqsafe() and rtw_fw_c2h_cmd_handle() compute the C2H
> payload length as
> 
>         len = skb->len - pkt_offset - 2;
> 
> where len is a u8, without checking that the skb holds the 2-byte C2H
> header (id and seq).
> 
> If the header is incomplete, the C2H payload length underflows: zero
> bytes after pkt_offset produce len = 254, and one byte produces
> len = 255. With zero bytes, reading c2h->id also accesses data beyond
> skb->len. The wrapped len defeats the minimum-length checks in
> rtw_fw_ra_report_handle() and rtw_coex_wl_fwdbginfo_notify(), which then
> read their fixed-size reports beyond the valid packet data.
> 
> skb->len is pkt_offset plus pkt_len from the RX descriptor, and
> rtw_rx_query_rx_desc() returns for C2H packets before its
> "pkt_len <= FCS_LEN" check, so a short C2H packet is not rejected there.
> 
> Drop C2H packets that are too short to hold the C2H header. Since
> rtw_fw_c2h_cmd_handle() only sees skbs queued by
> rtw_fw_c2h_cmd_rx_irqsafe(), this covers both computations.

No need much commit message. Just say that you are validating C2H packet
length before reading.

> 
> Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM

This tag is no long necessary. 

> Signed-off-by: Huihui Huang <hhhuang@smu.edu.sg>
> Reviewed-by: Luka Gejak <luka.gejak@linux.dev>

As I requested to reword commit message, you can still take Luka's reviewed-by.



  reply	other threads:[~2026-11-08  2:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 12:59 [PATCH rtw-next v3 0/2] wifi: rtw88: check C2H header and payload lengths Huihui Huang
2026-11-05 12:59 ` [PATCH rtw-next v3 1/2] wifi: rtw88: drop C2H packets shorter than the C2H header Huihui Huang
2026-11-08  2:31   ` Ping-Ke Shih [this message]
2026-11-05 12:59 ` [PATCH rtw-next v3 2/2] wifi: rtw88: check the C2H payload length before reading it Huihui Huang
2026-11-06 14:12   ` Luka Gejak
2026-11-08  2:56   ` Ping-Ke Shih
2026-11-08  7:25     ` Luka Gejak
2026-11-09  2:07       ` 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=3b5749624a53468bad7b2c0b74c74d69@realtek.com \
    --to=pkshih@realtek.com \
    --cc=hhhuang@smu.edu.sg \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luka.gejak@linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox