🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19777

[PATCH net v3 1/5] net: wwan: iosm: validate the MUX DL block length

#19777
From: Fang Xieyan
Date: Fri, 20 Nov 2026 10:55
72 lines
11053 bytes
The received length of a DL MUX block is supplied by the device and can
be shorter than the header its signature advertises. ipc_mux_dl_decode()
reads the four byte signature and then lets the decoders index their
header structures without checking skb->len, so a short block makes the
driver decode past the received data.

Check the signature before reading it, and check the header size of the
ADGH, FCTH and CMDH branches before dispatching to their decoders. The
ADB branch already validates its own headers, and the ACBH branch is
covered by the bounds checks of its command chain walk. A block too
short to carry its signature is dropped on the way to the single free.

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 | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
index 2b8a22980c87..1c5aae25f08f 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
@@ -693,6 +693,11 @@ void ipc_mux_dl_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
 {
 	u32 signature;
 
+	if (skb->len < sizeof(signature)) {
+		dev_err(ipc_mux->dev, "invalid MUX block length %u", skb->len);
+		goto free_skb;
+	}
+
 	/* Decode the MUX header type. */
 	signature = le32_to_cpup((__le32 *)skb->data);
 
@@ -701,15 +706,24 @@ void ipc_mux_dl_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
 		mux_dl_adb_decode(ipc_mux, skb);
 		break;
 	case IOSM_AGGR_MUX_SIG_ADGH:
+		if (skb->len < sizeof(struct mux_adgh))
+			break;
+
 		ipc_mux_dl_adgh_decode(ipc_mux, skb);
 		break;
 	case MUX_SIG_FCTH:
+		if (skb->len < sizeof(struct ipc_mem_lite_gen_tbl))
+			break;
+
 		ipc_mux_dl_fcth_decode(ipc_mux, skb->data);
 		break;
 	case IOSM_AGGR_MUX_SIG_ACBH:	/* Aggregated Command Block Header */
 		ipc_mux_dl_acb_decode(ipc_mux, skb);
 		break;
 	case MUX_SIG_CMDH:
+		if (skb->len < offsetof(struct mux_lite_cmdh, param))
+			break;
+
 		ipc_mux_dl_cmd_decode(ipc_mux, skb);
 		break;
 
@@ -717,6 +731,7 @@ void ipc_mux_dl_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
 		dev_err(ipc_mux->dev, "invalid ABH signature");
 	}
 
+free_skb:
 	ipc_pcie_kfree_skb(ipc_mux->pcie, skb);
 }
 
-- 
2.50.1
Technical Details
Message-ID: <20261120105559.54519-2-fangxy@xiaopeng.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367884-linux-kernel-netdev=dewy.ru
References: <20261120105559.54519-1-fangxy@xiaopeng.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367884-linux-kernel-netdev=dewy.ru
From: fangxy@xiaopeng.com (Fang Xieyan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 1/5] net: wwan: iosm: validate the MUX DL block length
Date: Fri, 20 Nov 2026 18:55:55 +0800
Organization: Usenet Network
Message-ID: <20261120105559.54519-2-fangxy@xiaopeng.com>
References: <20261120105559.54519-1-fangxy@xiaopeng.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3138916"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:U36TkEUiOHt8r1WLQB4DlIRMqIM= sha256:S2q5Cb/DGybKpBcQ00HAZ7jrBoY3doFDqpLaCjcMEp8=
	sha1:Ln7qy3TpurY7AA5uo/xxdHPooFY= sha256:gmAUxS6TOL+EmY+e4gUO2hKGwdi6RmPhUm8Rv/jFw6s=
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 AC1B8115973; Fri, 20 Nov 2026 13:56:58 +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 XSV7Uh16ziJM;
	Fri, 20 Nov 2026 13:56:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-367884-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 7A9A111596D; Fri, 20 Nov 2026 13:56:47 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 063B7180081; Fri, 20 Nov 2026 10:56:34 +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=1795172179;
	b=TOFZGOMgs5cu5z7r0KuSVjNiAvSyA5jXWukcbsWCutv596qIf9XkOK+XxQ24P4S84VXK
	 aPKMJYU3lXz42tOpAM2kZERzp143scyaCN+WIduUvSStMgwqJyZhmqjmBc1WwbezCpFD1
	 N2hNSFwC2+/17OWxyPofpWSehxYEacla+nbhqsTkhYQMfXmieHIeW9q9T/rER0Bg9vw0h
	 Hok00YF43tvEHjt9FBLfljGmGt7CmJDqVEmj4bAL3HO7fE/qC+sdh+fRq9ZUbBzROQr6l
	 g+m89w7Bhpn1s057ovvflatipVG6dnb89/i7xRv6emnL5uME+b+FbcrX52mSqzC9ARA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795172179;
	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=3cFlORKO4ZMUPJ7YeS0hbOVYAx1+1ovhhSAf8EKDuHs=;
	b=lA2MGvdfUql8NgEYnBa0ndJRbw60YOIgewtyoteBzrGPqcjKbaHcAHf/Y1ijAZhNN1Nq
	 h+c4BSa61a+glIdc/6GPHNDx3OiUfpL0cwIATOw4uiipAyJnV3krRZI0taKiFblCOoluB
	 N3o1/M+Lb/E5oaJ0O20Uw3KPF2aWwONDX+y7cJp0LykFmMMwl1tp/efw02oXzGNuXF9kc
	 W3H6TbnhGx6E5D+4KIrv0evgt+0hbeEtpJuJbhAnzaD5ZbYy9kmoJU1HlDDlaqYm8gzwl
	 +gef13FabBBK0y675kyv3LxdMoZSYCILyECiH6M4PSKEeCZpuqAC1jjCmXRNf963jXQ==
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="pZqiPFV/";
	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 44A81606A33C;
	Fri, 20 Nov 2026 10:56:19 +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=pZqiPFV/
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.28.50
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795172173;
	b=RGlRYspJlC/KDtuYYOJHIyUFXs2XbV3lET4W/pa4WBCjhOHu2pBMcw5awR5oRNsYFCSp
	 k2KN7OPfobdexyMLzskxeleTnORhztbbmXXhdfsnaKcIqNRhMj2ni6g0bc52Vs2IU7N/4
	 0PXe6DeDMcA/y0q35j7k7G3RL3TVL+j4Gnouvam94U2TQUmtbeeXtc+nbHL1cU9JkohL+
	 /z7tElC1ShQON7yIoB+mZEzTsr0ZvRVHMFKIJ8gEx+rCLn6uTGp+stf/VQUoBAQk5hJTL
	 03fHbK/mnIRx5xjP2CF/iFOFsZz1EtzQ7+++tRNCX5rlNJlDsx6YcCTEb3KVQzKwcpw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795172173;
	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=3cFlORKO4ZMUPJ7YeS0hbOVYAx1+1ovhhSAf8EKDuHs=;
	b=uzHzWYE+wdSgBhwdbVM11yaDnxJzO2iagVMa2pXSVXk+ov5REQYvMKtl+yDVhE+dGXwF
	 xGcqWjA0TR3h9O+jHTPjKujWQ5wp7tR7o68FRQbjk/5IcSE07G7OdE5dx62gpUwBGb719
	 9TWQkD8MG/io96A8zAGqxFRmvFFhR0nKcon6bp5ly8QMB2HizcMDWaHV+yVlKMqa+rHOv
	 sHaeRd3m2qdAqJNwBsmVwxvxg7jjs6Mc6upW4XXmzf0RKxSLIvOwcCZmnRe0MbsrUUW6p
	 ah2C0rtSQe97THc6uzi2UEcpaDN1b/90ouUK/jeFcuIAAxVGEkqpPjr1vt68Rr8itsA==
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="pZqiPFV/";
	arc=none smtp.remote-ip=115.124.28.50
X-Received: from out28-50.mail.aliyun.com (out28-50.mail.aliyun.com [115.124.28.50])
	(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 BB4AD606A337;
	Fri, 20 Nov 2026 10:56:11 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BB4AD606A337
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=1795172162; h=From:To:Subject:Date:Message-ID:MIME-Version;
	bh=3cFlORKO4ZMUPJ7YeS0hbOVYAx1+1ovhhSAf8EKDuHs=;
	b=pZqiPFV/Qncfi2P3lRh14T26vDvJehVJR+j8otLvcq7LhcYktxqOP3VGAWX0PS65Pvkzy8GDZUmXcyj9TCf4173TY3Y40bPQGad02tnX0orpZPuMygRY6V2AN7IRvbVjd+P85h9kFGVPKpW050IHFkKjYnE03fx7pSKZqoX9+fc=
X-Alimail-AntiSpam: AC=CONTINUE;BC=0.04441332|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.00496029-0.000681013-0.994359;FP=6633282784209179140|1|1|4|0|-1|-1|-1;HT=maildocker-contentspam033037034017;MF=fangxy@xiaopeng.com;NM=1;PH=DS;RN=14;RT=14;SR=0;TI=SMTPD_---.k6Wwa21_1795172161;
X-Received: from localhost.localdomain(mailfrom:fangxy@xiaopeng.com fp:SMTPD_---.k6Wwa21_1795172161 cluster:ay29)
          by smtp.aliyun-inc.com;
          Fri, 20 Nov 2026 18:56:02 +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>,
	Guanglei Zhu <zhugl3@xiaopeng.com>,
	linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
X-Mailer: git-send-email 2.50.1
X-In-Reply-To: <20261120105559.54519-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