🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15156

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

#15156
From: Fang Xieyan
Date: Thu, 12 Nov 2026 12:51
72 lines
11138 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 0bbd41263cc2..5c33171ca701 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
@@ -696,6 +696,11 @@ void ipc_mux_dl_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
 	if (!skb->data)
 		return;
 
+	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);
 
@@ -704,15 +709,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;
 
@@ -720,6 +734,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: <20261112125201.1019-2-fangxy@xiaopeng.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361810-linux-kernel-netdev=dewy.ru
References: <20261112125201.1019-1-fangxy@xiaopeng.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361810-linux-kernel-netdev=dewy.ru
From: fangxy@xiaopeng.com (Fang Xieyan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/5] net: wwan: iosm: validate the MUX DL block length
Date: Thu, 12 Nov 2026 20:51:57 +0800
Organization: Usenet Network
Message-ID: <20261112125201.1019-2-fangxy@xiaopeng.com>
References: <20261112125201.1019-1-fangxy@xiaopeng.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1092539"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:2nel4xWwoFS+HgaouFziZ6hQT+g= sha256:pZgevGLPsDOHwoLywnuUXRkCbNFIud7ynFqvSHtsILM=
	sha1:e+Z1W1990/pbVMayA3O6g5pBqw8= sha256:ZdgSBwkQKDfg2h/5HcHPnSyAWXO9qJ0ZNqHzpBBx6lw=
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 08C3211420C; Thu, 12 Nov 2026 16:23:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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]
	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 DGeaWJSkZ9NX;
	Thu, 12 Nov 2026 16:23:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-361810-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 4B80D114247; Thu, 12 Nov 2026 16:23:39 +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 C5C55C85CC; Thu, 12 Nov 2026 12:52:56 +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=1794487943;
	b=oF0bvPHSNpOhiGEboEhWu+YUqSZIxHl/SR3VTkE+uaD8P0av7cYiGhlZYd9WnEcXS/sG
	 +5cmCVukqgKcWHI+kNIAtxQzjsdNTHlmm5xw8bWfl4uhzNJw85YnOZrlXUtM0xDHe4+zB
	 g6QnOQAN6DzO1MBSsJXatGAAdsGuEZhs8wguvWVPCJJOrl5ijan6biVf4Lw5vSGgyJ+Rr
	 ybFXe+ExWNDXHxwjTHDWCUsikyY6NZTNllaZFVbm8cA6P5rcXJjdgOyZVErHW9yETIt3A
	 ugBEs/aUrbLBEP9Ivlx+SxJzZTat5FD6hr72y02r5lSHyKjgLn9MYL8sbCdBbsNU/uA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794487943;
	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=gdGXhDc04esq8UKmQV0Kr8mQHHzjU1OgZnFCkRowno4=;
	b=nuteP+mAdc99jVG76xb3d9M9KPeTSgO9SWuGozXX8pDtENxQJhDVh4oyknZVxhrLS/oy
	 If6tYHHKNvJwsr9vq3JCwjk6w1AjXVdTULOyjU3wnq1ohfXrPA5nfqvaTl/vjPMjlW+Qi
	 ueW3WTdrd5ynwVHz2qD5SIO+ae9hZ0pyJfHRFhgge3ywfDeemHuLVf47g2eYIpQla9EGV
	 BGhWZ22Rj2wVYtiJq3FBGLH35A1Wybv2lbFITEnJywgmjdUqM3OUaeontpJs3BOGGP4RT
	 LnVDaOUQa4uh2RmEDVsPSSp3vrvniZ+Cj988Q8pcsLGknsTMXPbXgWeMPrtEAY6MP8A==
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=OFOQl+s4;
	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 631AF606A331;
	Thu, 12 Nov 2026 12:52:23 +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=OFOQl+s4
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.28.149
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794487932;
	b=UPqFTAtJQutKKEPFHo9Rvo5eUMPwmrYTdmlfxVhqDw0FEdqoKK7NyfGMQsDwTeFoCZBh
	 0rAza/ttu8WFSdtfm8/jE/OMytDSntJhzZpjSXkjUrG8m0s32XuqVuIRhWmG9xwNLnWxX
	 LzP5jo6oeJQmsWRSLEF+Pb051CdeRL7FT2G6dmFedQqrJBSFwZfDaWR/3Q1ScUgrQw5Ts
	 kqI0YWU1Bw0wFCsv/hRF37saN7/isniw2K7Bx2Gly7WqcMjqQ4/1qIjFtCcLbrmzJTqwW
	 hKEv69/ffVpjXgEbugvonp60O69e9sc7es984fQRGJgCKfrcswf6wMiO/BokBPH1ikQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794487932;
	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=gdGXhDc04esq8UKmQV0Kr8mQHHzjU1OgZnFCkRowno4=;
	b=Zo7Gu8NQBLfMCzd+PzEvQUKkkXP4L1ZSiVzyC0OTIptdlfJ05rQuYgKD80TMcrkRexUP
	 xGoyrYSYH8h/c9mIwt4qBUgi4uRV2w+Vzrt/3nIypJa7+pEj6ni5bgMGnQNpEwhBJ9jOQ
	 JbPJtb7Jo9SKBamNWWyIYaSdToP6TjgGLe5cbaYihpo7i7hYavSwEWfMB23FARXyHbzvz
	 dkBl1Veqtr3jt6N4ei32LFfHQSPuoh6XJPOzYup6PQ3FkGk8oP+bqkVGXBKfouxmcS49/
	 RpH1u1W4A2xdJldaw+JgBDd4PV5gUk7/IyjdikZkGHciwDSYUZMK9l+JewKXG+yUEsw==
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=OFOQl+s4;
	arc=none smtp.remote-ip=115.124.28.149
X-Received: from out28-149.mail.aliyun.com (out28-149.mail.aliyun.com [115.124.28.149])
	(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 0C48A606A31C;
	Thu, 12 Nov 2026 12:52:09 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0C48A606A31C
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=1794487926; h=From:To:Subject:Date:Message-ID:MIME-Version;
	bh=gdGXhDc04esq8UKmQV0Kr8mQHHzjU1OgZnFCkRowno4=;
	b=OFOQl+s4IZCeKVqlyERusFyYfJpcmjDRyKwujPD9KsL/MUZa73ePiLueKml4CapiatXpTH3Z3giAD8OO06pY5I/ue6R9LxAZbd/vnz7VgNftbTH4KLTQfZaduVxLxNO9DUnvh8aE7Z4mWp98e28RbdoUdTVfj608bdugRtulRgM=
X-Alimail-AntiSpam: AC=CONTINUE;BC=0.04441183|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.00516513-0.000828919-0.994006;FP=15856795541377683968|0|0|0|0|-1|-1|-1;HT=maildocker-contentspam033037028158;MF=fangxy@xiaopeng.com;NM=1;PH=DS;RN=15;RT=15;SR=0;TI=SMTPD_---.k0cpdbS_1794487924;
X-Received: from localhost.localdomain(mailfrom:fangxy@xiaopeng.com fp:SMTPD_---.k0cpdbS_1794487924 cluster:ay29)
          by smtp.aliyun-inc.com;
          Thu, 12 Nov 2026 20:52:05 +0800
X-Cc: Johannes Berg <johannes@sipsolutions.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org,
	Maoyi Xie <maoyixie.tju@gmail.com>,
	Simon Horman <horms@kernel.org>,
	M Chetan Kumar <m.chetan.kumar@linux.intel.com>,
	stable@vger.kernel.org,
	Guanglei Zhu <zhugl3@xiaopeng.com>
X-Mailer: git-send-email 2.50.1
X-In-Reply-To: <20261112125201.1019-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