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, johannes@sipsolutions.net,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org,
maoyixie.tju@gmail.com, horms@kernel.org,
m.chetan.kumar@linux.intel.com, zhugl3@xiaopeng.com
Subject: Re: [PATCH net 2/5] net: wwan: iosm: validate the ADGH datagram length
Date: Mon, 16 Nov 2026 13:55:17 +0000 [thread overview]
Message-ID: <179483731765.3136.9756237680420915159@kernel.org> (raw)
In-Reply-To: <20261112125201.1019-3-fangxy@xiaopeng.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The new ADGH length check in ipc_mux_dl_adgh_decode() is
`adgh_len < packet_offset || adgh_len > skb->len`.
--
net: wwan: iosm: validate the ADGH datagram length
This patch adds a bounds check on the device-supplied adgh->length in
ipc_mux_dl_adgh_decode(). The block is dropped unless the length covers
packet_offset and fits within skb->len. Without the check, a short length
wraps the payload size computed as adgh_len - packet_offset.
> diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
> index 5c33171ca7012..b573067a366f0 100644
> --- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
> +++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
> @@ -473,6 +473,15 @@ static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux,
> if_id += ipc_mux->wwan_q_offset;
> adgh_len = le16_to_cpu(adgh->length);
>
> + /* The device supplied length bounds the datagram. It has to
> + * cover packet_offset and fit into the received block.
> + */
> + if (adgh_len < packet_offset || adgh_len > skb->len) {
[Severity: Low]
Should the lower bound be adgh_len <= packet_offset?
With the strict comparison, adgh_len == packet_offset still passes. That
gives a datagram with no payload, and ipc_mux_net_receive() is called with
pkt_len == 0.
For example, the modem could send a 16-byte ADGH block with
adgh->length == 16. dl_head_pad_len is IPC_MEM_DL_ETH_OFFSET, so pad_len
is 0 and packet_offset is 16. ipc_mux_net_receive() then does:
skb_pull(dest_skb, offset);
skb_trim(dest_skb, pkt_len);
and the clone reaches ipc_wwan_receive() with len 0. That function reads
the first byte without checking skb->len:
drivers/net/wwan/iosm/iosm_ipc_wwan.c:ipc_wwan_receive() {
...
if ((skb->data[0] & IOSM_IP_TYPE_MASK) == IOSM_IP_TYPE_IPV4)
skb->protocol = htons(ETH_P_IP);
...
}
So skb->protocol comes from a stale byte past the datagram. The empty frame
is also counted in rx_packets/rx_bytes and passed to netif_rx(). The read
stays inside the DL buffer allocation, so this is not a memory safety
problem.
The aggregated path for the same protocol, mux_dl_process_dg(), already
rejects this case:
if (dg_index >= le32_to_cpu(adbh->block_length) ||
dg_index >= skb->len ||
dg_len > skb->len - dg_index ||
dl_head_pad_len >= dg_len) {
goto dg_error;
Would using <= here make the ADGH and ADB decoders agree?
> + dev_err(ipc_mux->dev, "invalid ADGH length %u, skb len %u",
> + adgh_len, skb->len);
> + return;
> + }
> +
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112125201.1019-1-fangxy%40xiaopeng.com
next prev parent reply other threads:[~2026-11-16 13:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 12:51 [PATCH net 0/5] net: wwan: iosm: validate MUX DL lengths and offsets Fang Xieyan
2026-11-12 12:51 ` [PATCH net 1/5] net: wwan: iosm: validate the MUX DL block length Fang Xieyan
2026-11-12 12:51 ` [PATCH net 2/5] net: wwan: iosm: validate the ADGH datagram length Fang Xieyan
2026-11-16 13:55 ` netdev-bot+sashiko [this message]
2026-11-12 12:51 ` [PATCH net 3/5] net: wwan: iosm: bound the ACBH command chain walk Fang Xieyan
2026-11-12 12:52 ` [PATCH net 4/5] net: wwan: iosm: pass the DL command parameter by pointer Fang Xieyan
2026-11-12 12:52 ` [PATCH net 5/5] net: wwan: iosm: validate the command parameter length Fang Xieyan
2026-11-16 13:55 ` 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=179483731765.3136.9756237680420915159@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=m.chetan.kumar@linux.intel.com \
--cc=maoyixie.tju@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ryazanov.s.a@gmail.com \
--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