Re: [PATCH net v4 3/5] net: wwan: iosm: bound the ACBH command chain walk
From: netdev-bot+sashiko
Date: Wed Nov 25 2026 - 09:47:13 EST
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