From: netdev-bot+sashiko@kernel.org
To: fangxy@xiaopeng.com
Cc: loic.poulain@oss.qualcomm.com, ryazanov.s.a@gmail.com,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch,
horms@kernel.org, johannes@sipsolutions.net,
maoyixie.tju@gmail.com, zhugl3@xiaopeng.com,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net v4 3/5] net: wwan: iosm: bound the ACBH command chain walk
Date: Wed, 25 Nov 2026 14:46:35 +0000 [thread overview]
Message-ID: <179561799575.3135.6479440863275898585@kernel.org> (raw)
In-Reply-To: <20261121141850.73754-4-fangxy@xiaopeng.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] ipc_mux_dl_acb_decode()
(drivers/net/wwan/iosm/iosm_ipc_mux_codec.c:548-549) adds a new early…
--
net: wwan: iosm: bound the ACBH command chain walk
This patch rewrites the ACB command chain walk in ipc_mux_dl_acb_decode().
Every command offset is now bounded by skb->len, and next_cmd_index is
validated before each command is processed. The array_index_nospec() clamp
is removed and a sanity check on acbh->block_length is added.
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
> index 65421f6b4c91e..a8448e273c021 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
> @@ -526,30 +526,60 @@ static void ipc_mux_dl_acbcmd_decode(struct iosm_mux *ipc_mux,
[ ... ]
> acbh = (struct mux_acbh *)(skb->data);
> block = (u8 *)(skb->data);
> + block_length = le32_to_cpu(acbh->block_length);
>
> - next_cmd_index = le32_to_cpu(acbh->first_cmd_index);
> - next_cmd_index = array_index_nospec(next_cmd_index,
> - sizeof(struct mux_cmdh));
> + /*
> + * The uplink encoder leaves block_length at the ACBH header size.
> + * It cannot delimit the command chain, so use skb->len to bound
> + * the command offsets.
> + */
> + if (block_length < sizeof(struct mux_acbh) || block_length > skb->len)
> + return;
[Severity: Medium]
Could this new check end up dropping every downlink ACB?
Before this patch, ipc_mux_dl_acb_decode() never read acbh->block_length.
The comment just above says the field cannot delimit the command chain.
Every later bound uses skb->len, so the check does not seem to protect any
of the reads.
The only in-tree code that writes this field is the uplink encoder, and it
leaves the field at the header size:
drivers/net/wwan/iosm/iosm_ipc_mux_codec.c:ipc_mux_acb_init() {
...
header->block_length = cpu_to_le32(sizeof(struct mux_acbh));
header->first_cmd_index = header->block_length;
...
}
That value passes the check. However, nothing in the driver shows what the
7360 CP firmware writes to block_length in DL ACBs. If it writes 0, or any
value outside [sizeof(struct mux_acbh), skb->len], the whole ACB is
dropped without any message.
That would include MUX_CMD_OPEN_SESSION_RESP, so the blocking wait in
ipc_mux_session_open_send() would time out:
drivers/net/wwan/iosm/iosm_ipc_mux.c:ipc_mux_session_open_send() {
...
acb->wanted_response = MUX_CMD_OPEN_SESSION_RESP;
if (ipc_mux_dl_acb_send_cmds(ipc_mux, MUX_CMD_OPEN_SESSION, if_id, 0,
¶m, sizeof(param.open_session), true,
false) ||
acb->got_response != MUX_CMD_OPEN_SESSION_RESP) {
...
}
FLOW_CTL_ENABLE, FLOW_CTL_DISABLE and LINK_STATUS_REPORT commands would be
dropped too. No FLOW_CTL_ACK would go back to the CP, and
session->net_tx_stop and session->flow_ctl_mask would never be updated.
This patch is tagged for stable, and the block_length check is still
present in the final state of the series. Would it be safer to drop the
check, or at least log when it fires?
A smaller related point: the new next_cmd_index check later in the loop
drops the current command even when its own header is valid:
if (next_cmd_index != 0 &&
(next_cmd_index <= cmd_index ||
next_cmd_index - cmd_index < hdr_len ||
next_cmd_index > skb->len ||
skb->len - next_cmd_index < hdr_len))
break;
None of the new rejection paths in ipc_mux_dl_acb_decode() log anything.
The ADGH change in the same series does add a dev_err(). Would a
ratelimited dev_err() on these paths help make a firmware mismatch
visible?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121141850.73754-1-fangxy%40xiaopeng.com
next prev parent reply other threads:[~2026-11-25 14:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 14:18 [PATCH net v4 0/5] net: wwan: iosm: validate MUX DL lengths and offsets Fang Xieyan
2026-11-21 14:18 ` [PATCH net v4 1/5] net: wwan: iosm: validate the MUX DL block length Fang Xieyan
2026-11-21 14:18 ` [PATCH net v4 2/5] net: wwan: iosm: validate the ADGH datagram length Fang Xieyan
2026-11-25 14:46 ` netdev-bot+sashiko
2026-11-21 14:18 ` [PATCH net v4 3/5] net: wwan: iosm: bound the ACBH command chain walk Fang Xieyan
2026-11-25 14:46 ` netdev-bot+sashiko [this message]
2026-11-21 14:18 ` [PATCH net v4 4/5] net: wwan: iosm: pass the DL command parameter by pointer Fang Xieyan
2026-11-21 14:18 ` [PATCH net v4 5/5] net: wwan: iosm: validate the command parameter length Fang Xieyan
2026-11-25 14:46 ` netdev-bot+sashiko
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=179561799575.3135.6479440863275898585@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fangxy@xiaopeng.com \
--cc=horms@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=maoyixie.tju@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ryazanov.s.a@gmail.com \
--cc=stable@vger.kernel.org \
--cc=zhugl3@xiaopeng.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®