Article View: linux.kernel.netdev
Article #18026[PATCH net v2 4/5] net: wwan: iosm: pass the DL command parameter by pointer
From: Fang Xieyan
Date: Tue, 17 Nov 2026 17:39
Date: Tue, 17 Nov 2026 17:39
115 lines
13353 bytes
13353 bytes
ipc_mux_dl_cmdresps_decode_process() takes the twelve byte union
mux_cmd_param by value, so every received command copies the whole
union out of the skb even when its type only needs one member,
reading past what arrived for a truncated response. The driver also
builds its link status response inside the received block.
Take the parameter as a const pointer and keep the lite path response
in a local variable; the aggregated path sends no response parameter.
The session response path still copies the full parameter union here.
The next patch adds the received parameter length check and restricts
each response copy to its own member. This change is a prerequisite
for that fix and is tagged for stable alongside it.
Fixes: 9413491e20e1 ("net: iosm: encode or decode datagram")
Cc: stable@vger.kernel.org
Reviewed-by: Guanglei Zhu <zhugl3@xiaopeng.com>
Signed-off-by: Fang Xieyan <fangxy@xiaopeng.com>
---
drivers/net/wwan/iosm/iosm_ipc_mux_codec.c | 29 ++++++++++------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
index a8448e273c02..3f93d7293785 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
@@ -184,7 +184,7 @@ void ipc_mux_netif_tx_flowctrl(struct mux_session *session, int idx, bool on)
}
static int ipc_mux_dl_cmdresps_decode_process(struct iosm_mux *ipc_mux,
- union mux_cmd_param param,
+ const union mux_cmd_param *param,
__le32 command_type, u8 if_id,
__le32 transaction_id)
{
@@ -194,7 +194,7 @@ static int ipc_mux_dl_cmdresps_decode_process(struct iosm_mux *ipc_mux,
case MUX_CMD_OPEN_SESSION_RESP:
case MUX_CMD_CLOSE_SESSION_RESP:
/* Resume the control application. */
- acb->got_param = param;
+ acb->got_param = *param;
break;
case MUX_LITE_CMD_FLOW_CTL_ACK:
@@ -318,7 +318,7 @@ static void ipc_mux_dl_cmd_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
__le32 trans_id = cmdh->transaction_id;
int size;
- if (ipc_mux_dl_cmdresps_decode_process(ipc_mux, cmdh->param,
+ if (ipc_mux_dl_cmdresps_decode_process(ipc_mux, &cmdh->param,
cmdh->command_type, cmdh->if_id,
cmdh->transaction_id)) {
/* Unable to decode command response indicates the cmd_type
@@ -333,14 +333,15 @@ static void ipc_mux_dl_cmd_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
/* Decoded command may need a response. Give the
* response according to the command type.
*/
+ union mux_cmd_param response = {};
union mux_cmd_param *mux_cmd = NULL;
size_t size = 0;
u32 cmd = MUX_LITE_CMD_LINK_STATUS_REPORT_RESP;
if (cmdh->command_type ==
cpu_to_le32(MUX_LITE_CMD_LINK_STATUS_REPORT)) {
- mux_cmd = &cmdh->param;
- mux_cmd->link_status_resp.response =
+ mux_cmd = &response;
+ response.link_status_resp.response =
cpu_to_le32(MUX_CMD_RESP_SUCCESS);
/* response field is u32 */
size = sizeof(u32);
@@ -500,26 +501,22 @@ static void ipc_mux_dl_acbcmd_decode(struct iosm_mux *ipc_mux,
u32 fctl_dis = IOSM_AGGR_MUX_CMD_FLOW_CTL_DISABLE;
u32 fctl_ena = IOSM_AGGR_MUX_CMD_FLOW_CTL_ENABLE;
u32 fctl_ack = IOSM_AGGR_MUX_CMD_FLOW_CTL_ACK;
- union mux_cmd_param *cmd_p = NULL;
u32 cmd = link_st;
u32 trans_id;
if (!ipc_mux_dl_cmds_decode_process(ipc_mux, &cmdh->param,
cmdh->command_type, cmdh->if_id,
cmdh->cmd_len, size)) {
- size = 0;
- if (cmdh->command_type == cpu_to_le32(link_st)) {
- cmd_p = &cmdh->param;
- cmd_p->link_status_resp.response = MUX_CMD_RESP_SUCCESS;
- } else if ((cmdh->command_type == cpu_to_le32(fctl_ena)) ||
- (cmdh->command_type == cpu_to_le32(fctl_dis))) {
+ if (cmdh->command_type == cpu_to_le32(fctl_ena) ||
+ cmdh->command_type == cpu_to_le32(fctl_dis))
cmd = fctl_ack;
- } else {
+ else if (cmdh->command_type != cpu_to_le32(link_st))
return;
- }
+
trans_id = le32_to_cpu(cmdh->transaction_id);
+ /* No response parameter is sent in the aggregated protocol. */
ipc_mux_dl_acb_send_cmds(ipc_mux, cmd, cmdh->if_id,
- trans_id, cmd_p, size, false, true);
+ trans_id, NULL, 0, false, true);
}
}
@@ -571,7 +568,7 @@ static void ipc_mux_dl_acb_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
skb->len - next_cmd_index < hdr_len))
break;
- if (ipc_mux_dl_cmdresps_decode_process(ipc_mux, cmdh->param,
+ if (ipc_mux_dl_cmdresps_decode_process(ipc_mux, &cmdh->param,
cmdh->command_type,
cmdh->if_id,
cmdh->transaction_id)) {
--
2.50.1
Technical Details
Message-ID:
<20261117173940.34970-5-fangxy@xiaopeng.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365508-linux-kernel-netdev=dewy.ruReferences:
<20261117173940.34970-1-fangxy@xiaopeng.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365508-linux-kernel-netdev=dewy.ru
From: fangxy@xiaopeng.com (Fang Xieyan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 4/5] net: wwan: iosm: pass the DL command parameter by pointer
Date: Wed, 18 Nov 2026 01:39:39 +0800
Organization: Usenet Network
Message-ID: <20261117173940.34970-5-fangxy@xiaopeng.com>
References: <20261117173940.34970-1-fangxy@xiaopeng.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2391085"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:kDWb6O0XYjz/+XJmtHnEh7SpQBw= sha256:V3zxk+dF/Vk7t0NZi+t/1n4Tm3g8lpet9x1WZ3dnRjI=
sha1:fVCoIsX5mCH8YashGb8BjnNUOFw= sha256:SEIIWKxCmaw1ldMdIfhTh7ZZl6cWnMoytD67QKxGdlc=
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 C485E115020; Tue, 17 Nov 2026 20:41:05 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, URIBL_BLOCKED=0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
header.d=xiaopeng.com
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 ilzvIwbVLUtO;
Tue, 17 Nov 2026 20:41:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-365508-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=xiaopeng.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 1864E11501C; Tue, 17 Nov 2026 20:40:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id BEAEA3C2CB; Tue, 17 Nov 2026 17:40:47 +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=1794937240;
b=BMRT3UHTLUXzQuZ50U5JDXC/Rbt7bOOXpMfNjsUqJW7YERq13szFkkv5LtulyNL1TkfB
RvX/uSb8646jOXKz5g0OgsdR9GXxUgF8YswIs5ldDGUlq8iHkJzp7U1MbVRA3A6DteO81
tpzb4ATNUbnjJZq0dpSsUYlMP9f/7A3soknyoxv768HEdsZuIQs71kNCjKlgeJ9ZmxiiF
cOS/74pmFjqWpLCmuTqt/wtmsuERZDY12E/SKc3YJVb98t2olpZB0fZ05m2L3do5+cF8B
G5z7JJgkELHxX2X3vQLxB3dwJ5IIZwBSj+2xcypgWsKKirRfc2rkNqVgCN50g96YMtQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794937240;
h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:
X-Alimail-AntiSpam:Received:From:To:Cc:Subject:Date:Message-ID:
X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:List-Post:
List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
MIME-Version:Content-Transfer-Encoding;
bh=Pqdb1CZmw00+aWMEKUmzfViHJG+GiKGhJXCKYqajwNg=;
b=SC8HFaTYLoAnl7Cq1aWP9+9jmn2pbskCO8McMBN5MQjH1SI0CSsg47fROZlmNX3ZkEF1
77jgG4YgriyY69T6/wWVvsuKX82OFemBwGodmKMoUF1OA/9prHivaz6S1ZElKwy4bVdHM
XJKK/nXiQ9xIgTToab7TEw4yAkRtp996oyUBKJqtaFTWulo+cT9lsy5dIzstBcEsUoQZo
TJSGFOEsrAtEKp+XYr9XjmIQrOP+uaJZYbF3NTTQ1HHc9LqpDAYCW9i7EO78BRX5Tar68
0WEEbx1HCGdj4A9lWA/3zLp9o7bXXb9Qm0q2Q0ZqF41rjT2ZB9ABU5fxZiI39a+fzBQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=xiaopeng.com header.i=@xiaopeng.com header.a=rsa-sha256 header.s=default header.b=bqqO2wx1;
dmarc=none header.from=xiaopeng.com;
spf=pass smtp.mailfrom=xiaopeng.com;
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 B1350606A333;
Tue, 17 Nov 2026 17:40:40 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=xiaopeng.com header.i=@xiaopeng.com header.a=rsa-sha256 header.s=default header.b=bqqO2wx1
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.28.195
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794937239;
b=cEVnuA6efoxB+JkxrNTpjdE8zim4VvxLmLoTj9EBqtdeu1b3ppEzgmkRv8kJC1kRxTqp
s0xUA2+NWHIPh9Gi/KLHk5m/ZroAZOyzK8mEmJvOOBhFxcObjW96O14oA0wa5+bm2BUNk
sS9RBa043zwmd1hVgad15Javt8DT68OYl9zWSBAjFECYK+2R85+yucZ3Uhk8yz3/9aS9I
HdsgLCQ2WHOGdl/xoHRgYK8JZ7q/+8e6YTcqyq9PV7t+kJX5hd/gb22FJHDD4TqU2bSdN
7mZL3LOowSARBWxtbS3E9oJV6rDImB3M2sJSABM8kHEAWY3irLxJ0Om8TGNlPn056LQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794937239;
h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc:
Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=Pqdb1CZmw00+aWMEKUmzfViHJG+GiKGhJXCKYqajwNg=;
b=wx8ufiiGHRS53QKEJW2mGnF+lWOFcIu+V2A9EUB20MaAVBXooXrq7sRdiNyy8drZUrDa
0SA485laapkQlidF7iLmvBeW7q8buINijzVKBMd/Gd7d/lknbDy/EohpkpOGAW9b7whPD
x0466rHyAkfu/gvefPrfONqTKWDnnDjMG1yblnyyXLWkKXKP4/Wc6iCfjVyuDj7bptobd
aE1KRgnyzuNU5uIQkVDtc3U5wjV0yCixp5PjynwIkehSrzuydG7mSorfD1yAMhWIHvWNY
QqfJQbMrvOiRIgg/o2yVTQtjj8yBdzgwQYJbfMRELlpAzSlH+IKPb+rPZSTko3zxZaw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=xiaopeng.com;
spf=pass smtp.mailfrom=xiaopeng.com;
dkim=pass header.d=xiaopeng.com header.i=@xiaopeng.com header.a=rsa-sha256 header.s=default header.b=bqqO2wx1;
arc=none smtp.remote-ip=115.124.28.195
X-Received: from out28-195.mail.aliyun.com (out28-195.mail.aliyun.com [115.124.28.195])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 613DE606A33B;
Tue, 17 Nov 2026 17:40:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 613DE606A33B
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xiaopeng.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xiaopeng.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=xiaopeng.com; s=default;
t=1794937236; h=From:To:Subject:Date:Message-ID:MIME-Version;
bh=Pqdb1CZmw00+aWMEKUmzfViHJG+GiKGhJXCKYqajwNg=;
b=bqqO2wx1x7qX5jCgILaQicooZaAywUUVVnk/WMQMeumIrwFnKCiVwaqTA1i8n2YLVu8vvg0ORGuF1pfd75w5eLY7OXNQ0vEpvO41YEeYwdpqllvF00y6S95x+KZ9MA0fRPqmCXjCGWMd+ggyeWPS8dZVwJo/m72a6m6DWBPo3dw=
X-Alimail-AntiSpam: AC=CONTINUE;BC=0.04436263|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.00745487-0.000394108-0.992151;FP=16019490987614699539|0|0|0|0|-1|-1|-1;HT=maildocker-contentspam033032065030;MF=fangxy@xiaopeng.com;NM=1;PH=DS;RN=14;RT=14;SR=0;TI=SMTPD_---.k4BATO6_1794937233;
X-Received: from localhost.localdomain(mailfrom:fangxy@xiaopeng.com fp:SMTPD_---.k4BATO6_1794937233 cluster:ay29)
by smtp.aliyun-inc.com;
Wed, 18 Nov 2026 01:40:35 +0800
X-Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Simon Horman <horms@kernel.org>,
Johannes Berg <johannes@sipsolutions.net>,
Maoyi Xie <maoyixie.tju@gmail.com>,
linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
Guanglei Zhu <zhugl3@xiaopeng.com>
X-Mailer: git-send-email 2.50.1
X-In-Reply-To: <20261117173940.34970-1-fangxy@xiaopeng.com>
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