From: Zhao Li <enderaoelyther@gmail.com>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Johannes Berg <johannes@sipsolutions.net>,
Brian Norris <briannorris@chromium.org>,
Jeff Chen <chunfan.chen@gmail.com>,
Jeff Chen <jeff.chen_1@nxp.com>,
Francesco Dolcini <francesco@dolcini.it>,
Francesco Dolcini <francesco.dolcini@toradex.com>,
Pengpeng Hou <hppiscas@163.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] wifi: mwifiex: validate event lengths before copying bodies
Date: Sat, 21 Nov 2026 22:22:54 +0800 [thread overview]
Message-ID: <20261121142254.99326-1-enderaoelyther@gmail.com> (raw)
In-Reply-To: <20260731141600.2-mwifiex-v4-pengpeng@iscas.ac.cn>
On Fri, Jul 31, 2026 at 10:20:02PM +0800, Pengpeng Hou wrote:
> + if (skb->len < MWIFIEX_EVENT_HEADER_LEN ||
> + skb->len - MWIFIEX_EVENT_HEADER_LEN > MAX_EVENT_SIZE) {
One concern with v4: dropping SDIO events whose body is larger than
MAX_EVENT_SIZE (2048) would also drop events that do not use
adapter->event_body[]. SDIO command-port reads can reach 4 KiB,
and events such as EVENT_EXT_SCAN_REPORT are parsed directly from
adapter->event_skb->data. Rejecting skb->len < 4 and clamping the
memcpy() into event_body[] to MAX_EVENT_SIZE would protect event_body[]
without discarding > 2048-byte skbs.
However, clamping instead of dropping exposes a separate bug in
EVENT_RXBA_SYNC (which v4 happens to mask on SDIO). Both sta_event.c
and uap_event.c pass adapter->event_body paired with the untruncated
adapter->event_skb->len - sizeof(eventcause) as the u16 length to
mwifiex_11n_rxba_sync_event():
- When event_skb->len > 2052 (possible on SDIO, up to 4092 bytes),
the TLV walk reads past event_body[2047] into the following
mwifiex_adapter fields.
- On PCIe (untouched by v4), mwifiex_pcie_process_event_ready() has no
lower bound on evt_len: for evt_len 0..7 event_skb->len ends up at
0..3, and the u16 length argument wraps to 0xFFFC..0xFFFF.
nxpwifi (SDIO only) has the same RXBA_SYNC callers, and its SDIO copy
already clamps to MAX_EVENT_SIZE, so only the length argument is
unbounded there.
Checking event_skb->len >= sizeof(eventcause) and parsing RXBA_SYNC
from event_skb->data + sizeof(eventcause) (as the TDLS parser does)
would fix both the over-read and the u16 wrap across all transports,
without waiting for the PCIe buffer-return rework discussed in October.
Are you planning a v5, and would it make sense for me to send separate
fixes for EVENT_RXBA_SYNC in mwifiex and nxpwifi?
Thanks,
Zhao
prev parent reply other threads:[~2026-11-21 14:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 14:20 [PATCH v4] wifi: mwifiex: validate event lengths before copying bodies Pengpeng Hou
2026-08-04 7:32 ` Jeff Chen
2026-08-11 21:37 ` Brian Norris
2026-09-03 18:59 ` Johannes Berg
2026-10-14 2:52 ` Pengpeng Hou
2026-11-21 14:22 ` Zhao Li [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=20261121142254.99326-1-enderaoelyther@gmail.com \
--to=enderaoelyther@gmail.com \
--cc=briannorris@chromium.org \
--cc=chunfan.chen@gmail.com \
--cc=francesco.dolcini@toradex.com \
--cc=francesco@dolcini.it \
--cc=hppiscas@163.com \
--cc=jeff.chen_1@nxp.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pengpeng@iscas.ac.cn \
/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