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 5/5] net: wwan: iosm: validate the command parameter length
Date: Wed, 25 Nov 2026 14:46:37 +0000 [thread overview]
Message-ID: <179561799736.3135.13611936052638387312@kernel.org> (raw)
In-Reply-To: <20261121141850.73754-6-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] The new parameter-length check never uses the device-supplied
cmdh->cmd_len, which is what delimits a command in this wire format.
--
net: wwan: iosm: validate the command parameter length
This patch passes a parameter length to the iosm MUX command decoders.
Each decoder checks it against the parameter union member its command
type uses and returns -EMSGSIZE when the member does not fit. The length
comes from skb->len for MUX Lite, and from next_cmd_index or skb->len for
commands in an aggregated command block.
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
> index 3f93d72937858..b2bd53c5ba30f 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
[ ... ]
> @@ -315,18 +329,26 @@ static int ipc_mux_dl_cmds_decode_process(struct iosm_mux *ipc_mux,
> static void ipc_mux_dl_cmd_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
> {
> struct mux_lite_cmdh *cmdh = (struct mux_lite_cmdh *)skb->data;
> + size_t hdr_len = offsetof(struct mux_lite_cmdh, param);
> + size_t param_len = skb->len > hdr_len ? skb->len - hdr_len : 0;
[Severity: Medium]
Should param_len also be limited by cmdh->cmd_len here?
The kernel-doc for struct mux_lite_cmdh defines cmd_len as the length of
the command:
* @cmd_len: Length (in bytes) of the command. This length shall
* include the header size. Minimum value: 0x10
The encoders, ipc_mux_lite_add_cmd() and ipc_mux_acb_add_cmd(), also set
it to the header plus the parameter size, and skb_put() exactly that
much:
cmdh->cmd_len = cpu_to_le16(offsetof(struct mux_lite_cmdh, param) +
param_size);
...
skb_put(acb->skb, le16_to_cpu(cmdh->cmd_len));
Take an OPEN_SESSION_RESP that arrives with cmd_len = hdr_len + 4, so it
carries only the response code, with more bytes after it in the received
buffer. Would it still pass the new check in
ipc_mux_dl_cmdresps_decode_process()?
if (param_len < sizeof(param->open_session_resp))
return -EMSGSIZE;
/* Resume the control application. */
acb->got_param.open_session_resp = param->open_session_resp;
The reads now stay within skb->len. But the bytes after the command would
still be copied into acb->got_param. Then complete(&ipc_mux->channel->ul_sem)
would wake ipc_mux_session_open(), which uses those bytes as the response
and as ul_head_pad_len. A short FLOW_CTL would also have its mask read
from bytes beyond cmd_len.
ipc_mux_dl_acb_decode() seems to have the same gap. Each aggregated
command's extent comes from next_cmd_index or skb->len, not from its own
cmd_len:
cmd_end = next_cmd_index ? next_cmd_index : skb->len;
param_len = cmd_end - cmd_index - hdr_len;
So padding before the next command counts as parameter. For the last
command, the rest of the skb does too.
The commit message names this case as the bug being fixed:
"a truncated OPEN_SESSION_RESP copies bytes past the command into
acb->got_param"
It also says:
"cmd_len is passed to the decoder unchanged."
Would bounding the length by something like min(param_len, cmd_len -
hdr_len), when cmd_len >= hdr_len, be needed to cover the truncated
command case completely?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121141850.73754-1-fangxy%40xiaopeng.com
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
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 [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=179561799736.3135.13611936052638387312@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®