Article View: linux.kernel.netdev
Article #22580Re: [PATCH net v4 5/5] net: wwan: iosm: validate the command parameter length
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 14:46
Date: Wed, 25 Nov 2026 14:46
101 lines
11678 bytes
11678 bytes
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
Technical Details
Message-ID:
<179561799736.3135.13611936052638387312@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371423-linux-kernel-netdev=dewy.ruReferences:
<20261121141850.73754-6-fangxy@xiaopeng.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371423-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v4 5/5] net: wwan: iosm: validate the command parameter length Date: Wed, 25 Nov 2026 14:46:37 +0000 Organization: Usenet Network Message-ID: <179561799736.3135.13611936052638387312@kernel.org> References: <20261121141850.73754-6-fangxy@xiaopeng.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="232533"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Ha8hRuLVEmpOfMkhmC1NRCSuc5s= sha256:W2jUw3InPJo4k7Vda/1p8J/Chyu/plXZ3aU11ojE8KY= sha1:liUqv8KhcH01peteE2JW/UhSF0k= sha256:bn02YrXRPPeL3neTW0Ojme2w88USUCu0XjrBTcSgy08= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 7F540125E6E; Wed, 25 Nov 2026 17:46:59 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UrKK7psfD8uT; Wed, 25 Nov 2026 17:46:55 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-371423-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 4EAD8125E72; Wed, 25 Nov 2026 17:46:46 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 2D9952656C; Wed, 25 Nov 2026 14:46:42 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795618000; b=ZIQbY5kHYbW1r3DE90IjqqIa0TyXu/6lSwVkkhacyEOgSpU8Ys1LLDvMC/ZogI5/Cz6I Wm4U2NryNB1koGq9ndtgpCI2VlXMKM350mSdRyxLqOnAWBaneK8WmVTo7u9yqvBnx18k3 lBBJU+fnwM/ByqBKmJtOzqR3ZSHKvi/lKal7CiWn0gDpH9x3w3sTUaNjT/vL5NwQGl5bm fLaXxlLqhpFgPCJIu209/UaBsD0/Btwjmy34/PO+4kjsEsfZuC8Mrle0qQ+2P1zhtDY05 qIAjzwP7J0u9Dwi5aTIbgMbuyoWS8R0mdOzUEE02+2MkRSMlPHYlTBjtsLwkwU+Y7Lg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795618000; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=b9kKcVig7H0iZ/2XHKm7Sh1wjiLoMyVkdbjeEKEr+ec=; b=gsQQNR6pe3V3BucpDeFAtreaH7iw5l7bURf70xaMJSyxy/G1f3XUs4jnF8OXbyLJuArV mcgi8ZNrjhqqIAZ0eATWjc6RmsqiMh0q2+L6xNDDWNhcTXUfqQXtKpM63PSfaHEXjUk0Z c5W5xp4szGC2ajDE00GorNlfQOvupNJHolAmgWyswR/gJP+7Gl3Vg8bEZftvSAeXjXUHb QehllX09pQx8WkY7PjQH88S2Vx+IaUiq+PFXIO1/bDSwm4PFGqVlkqkHmZII+maa1dt8f cgd3sNBIIydHZS5+PUrDueXuzUTTDamIuKw4bn9+MZ577/6h8fN8DhCDFBkCECU3NzQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KP76lbip; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0BE5606A31E; Wed, 25 Nov 2026 14:46:39 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KP76lbip X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795617999; b=QMR053J8kA0QkWvtIbz7YUvVSWjBJztLaOyHZ7cgN//GGqiVgFXYFgjl7Bh/2CpkPMFU cdW2v+Y0ENA3Hw9zF2TMYRSfBHmctQwCTewvd/LBxNkGe2VOl1Uay8ZbcbtjkU3MAuawP DMMnliSNMGwVQZnb/ZZdqvusngNX+UAhpDtyarWzbYvzrsfx5l49n8JwtO8IL23+rWMwM uTB4/5hT6a/KHei3C+qnWhxPbOFHmCFq90iGDJ74k1pDiKQ4TQ3M2kaYelyMFeOtZ1iit JW4p5fn4gF7hWeu0ogqZF6dSPoLYKbV1MrxH6twGRzEfTlA3crq9P3JAx2ABpRMGkbA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795617999; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=b9kKcVig7H0iZ/2XHKm7Sh1wjiLoMyVkdbjeEKEr+ec=; b=KkB0D/TYvSOB4NTIuhCq6rCfSb7ruYzGhI/dyGZNNq7dD4Hb87d/u8t0uRQtEyDYzv5b 9TB9XYe+1aL7d16TrDFiovgZziSL0VRGrPTXIaAo+X7Taq/du6aAmDetjIUjkLL74Ztau F9tjgvv8fqqKijw4wLlOMYlDAZBeU7ZQLf09+vCwfBPqfgUKk2AvlJJLbBvgbXtcJDIZt sXRGcPY2u7Dtzq4oSpN9jDrkAHOFziqM9pjcjEySCISGB8WjcU+IioYdDqZnvgCbCsvwg LoEflzM6x6OiwM113YXx7JD6xC1NXUwyvnn9GfQe7A3EKfDLPl7trzZMnsSRG/IEnIQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KP76lbip; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D5CD606A687; Wed, 25 Nov 2026 14:46:39 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDF771F000C0; Wed, 25 Nov 2026 14:46:37 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795617998; bh=b9kKcVig7H0iZ/2XHKm7Sh1wjiLoMyVkdbjeEKEr+ec=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=KP76lbipDeb/PW4wJXqDQQ4iuiHoNaLs55ljwYkFpKSkSohkfjU9BRfhjZHq6U9yd rmQf5H/wUGz/cNZvhBBA1vK9iGLhE0MfOnITpyxtErUqEJKfuJW2TRyiI7eYp23QFH ZV4NVH55IhALmIN9fG9onSaiRbF4TWxpPz+BMXnD+ZG6wQSqD5THOwjFsmPfXfR3bE prt0XqqkyZr+Yr1CyqJl35Rb8V+yEvE947KOOCHaQCsI7bk1LgmzrNhIiKvBCzsGZN jpKE94alGxGgVBSmZ3RAhsNAuOcr0rGDJUcXtND0yJC3HkE89UD17XaJzA1iojqPz2 BJ7qCYLy2KN+A== X-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 X-In-Reply-To: <20261121141850.73754-6-fangxy@xiaopeng.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list