🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15143

[PATCH net 0/5] net: wwan: iosm: validate MUX DL lengths and offsets

#15143
From: Fang Xieyan
Date: Thu, 12 Nov 2026 12:51
68 lines
11979 bytes
Several lengths and offsets the MUX downlink decoders work with are
supplied by the modem: the size of the received block comes from a
device written transfer descriptor, and the ADGH datagram length, the
ACBH block length, the command chain offsets and the length a command
header declares for its parameter are all read from the block itself.
None of them is bounded against what actually arrived, so a truncated or
enlarged DL block makes the driver read past the received data, hand the
network stack a payload the device never declared, walk a command chain
that points back at itself, or decode the bytes of one command a second
time as the command following it. The aggregated datagram block path is
already covered by commit 526b8ef54668 ("net: wwan: iosm: bound device
offsets in the MUX downlink decoder") and is not touched here.

This series adds those bounds. The checks only relate the device
supplied lengths and offsets to the received data: no command type,
response or protocol semantics change, so a conforming modem behaves
exactly as before. Patch 4 is the prep change for patch 5, it stops the
driver from copying the received parameter union by value and from
building its answer inside the received block.

cmd_len is not used the same way in the two paths. In the aggregated
path the parameter boundary is next_cmd_index, or the end of the
received block for the last command: the flow control decoder already
keeps a backward compatible handling for a cmd_len that does not match
the header and its parameter size, so the field is not a hard bound
there. In MUX Lite it is an upper bound when it covers at least the
header; a smaller value is not taken as a usable declaration and the
received length stays the limit. That is a compatibility tolerance, not
a valid input: the protocol requires 0x10 or more.

A parameter too short for the member its command type reads is dropped
with -EMSGSIZE, which also ends an aggregated block at that command.

Patch 3 also delimits the command chain by the received length:
block_length is checked to cover the ACBH header and not exceed the
received buffer, but skb->len is what bounds the commands. The
array_index_nospec() call of the walk is gone with these explicit
checks: it bounds a byte offset by sizeof(struct mux_cmdh), which
turns every legal offset past that size into zero, while the checks
constrain the same value against the received length.
array_index_nospec() is kept only for if_id, an actual array index.

Patch 2 relies on the ADGH header check introduced by patch 1, and patch
5 relies on the ACBH block validation from patch 3 and on the parameter
pointer introduced by patch 4. Patches 1 through 3 apply cleanly and
build individually against the base, the series applies cleanly and
every commit builds, W=1 drivers/net/wwan/iosm/ is clean.

Found by reviewing the DL decode path against the MUX protocol
structures. Not reproduced on a live modem: reaching it needs a device
that truncates or enlarges its own downlink blocks.

The series is based on the net tree at 145480b28ca8 and applies to it
cleanly.

Fang Xieyan (5):
  net: wwan: iosm: validate the MUX DL block length
  net: wwan: iosm: validate the ADGH datagram length
  net: wwan: iosm: bound the ACBH command chain walk
  net: wwan: iosm: pass the DL command parameter by pointer
  net: wwan: iosm: validate the command parameter length

 drivers/net/wwan/iosm/iosm_ipc_mux_codec.c | 197 ++++++++++++++++++++++-------
 1 file changed, 151 insertions(+), 46 deletions(-)

-- 
2.50.1
Technical Details
Message-ID: <20261112125201.1019-1-fangxy@xiaopeng.com>
Path: mbox-mo1.pugleaf.net!news-lax.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-361812-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.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-361812-linux-kernel-netdev=dewy.ru
From: fangxy@xiaopeng.com (Fang Xieyan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 0/5] net: wwan: iosm: validate MUX DL lengths and offsets
Date: Thu, 12 Nov 2026 20:51:56 +0800
Organization: Usenet Network
Message-ID: <20261112125201.1019-1-fangxy@xiaopeng.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1089797"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BWHX/Fdjd9mD/aDJv6wJzNEXuEo= sha256:EkI9dwzszHVIzB/RMF5CH+Ys55ytanxgfMnZ5XsubI8=
	sha1:PV0KUTfy5CDW+8Rfid03JJ/KTeo= sha256:M3DmEpDBqWswAoa+t5QEXuoO//DS62/IggZyjNw9D2U=
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 340DD114233; Thu, 12 Nov 2026 16:05:50 +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 HH0X763RYW_z;
	Thu, 12 Nov 2026 16:05:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-361812-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 92E1A114227; Thu, 12 Nov 2026 16:05:38 +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 A1626C3872; Thu, 12 Nov 2026 12:52:25 +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=1794487938;
	b=yvCE819VM0ZEG2QmuRztwmGk4bMqRXI7F1E57Oq4EKV+XrlETh6FnB430WOprjEvAYIN
	 b0I3K8MP5B99WEusHowSr8XJGlVqqMZ+bzpTIYaVsO/xXwB1N/TolFSlKjwWN0Muf+x0+
	 I5LSKeen+2LZbwnefrVPa6fe6AVW0uS9RGEJn09ezjAHQKakLxnJGdySDIMj6hIvZeqPU
	 cgt5eHWLbfWGwKszsA5MueGcKL1Hu3p/G1hiRCfhW8Q2Z43kly2017yqpDnWB2i/dNcOw
	 XDvqGhXDIeQVyFi6VtIwoceIDQr0H4c+2qHhu6juF1WQDnTW/Tl545E26aI7QdtnfCw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794487938;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:
	 X-Alimail-AntiSpam:Received:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=KWl2nH8QGR76CCLtZk6bqGKfbZExirp/BPFDBGPTkYk=;
	b=D2HKADGCqcj610vgWfstA9Ji3iqYlf1hAQWplzxpUZpE0907+aexeIZtAD8gfb0DfE6N
	 Mg/pz+17yxFgkFw+6kScniULm9tQzy6qCVeupe7ctapHHTDo3jIQimPkDbfKJsmdnLnZJ
	 2HV0baSnKSo3fDxZsxI/M6GDpqql8HgHNG6Mk+yCD2mb5k74qv/XeUKzhsW9LzIuxz9DK
	 4wCHHTGKMw8/5UKsriwxgEUNnxFy1G0HBP3PEgVEYFbF+y6psPXz7OSm0WgudSF0sAp1w
	 LnS1MIWHw3t8x6ZaEEteXgUzb//ZDcQUNT5+REaeXtOT9WoKSaUiryhQ7mUJ30j3Vbg==
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=n3VRUvKO;
	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 2C763606A88C;
	Thu, 12 Nov 2026 12:52:18 +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=n3VRUvKO
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.28.170
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794487937;
	b=288DrwB78Z/PdijGkxIu0inbFRTfvO5J2mtyjvK7pIzWMUM9Id6gT4IMUxT2mxV9KXQD
	 AUfWHVYsoshkQSsXZtNnXKfF+p+aFY80JyoX7CD6JzCbwCiSZC1Iqz58ylKdEKnUJh5tu
	 Tq6911xfug7dYpxOdu+leHD6FUiBoyakCdVaR4T0QZRq1qeQJxN45iQ7Xi9t506RliAgQ
	 4bEBEZPhvzn6IdSJ/nRuoSpKR4npMtpUA21pBGCvMQuLUQD1HYyV3Oa32W0uG9vnC6tCF
	 S1jKqVK966kBWtlgImLzymXKIj8OaBL76dxKTlpw0mGrOc9I6AaBWYuQRDJTBlfSx+w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794487937;
	h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc:
	 Subject:Date:Message-ID:X-Mailer:MIME-Version:
	 Content-Transfer-Encoding;
	bh=KWl2nH8QGR76CCLtZk6bqGKfbZExirp/BPFDBGPTkYk=;
	b=oYd1RWT4Gz7AITUWZXZiKqJC8swXja//7o1OCj8kukmmjRdQhSP9bB3JV2xLBprIVfWW
	 qgioqf/IhhYQEhVGXzXlIN4CigEOKqkkgS2c/hiv2j8B4j2zjlFL7Lv+Uj1s7mShpauC2
	 kLI/5D+ayA/304YBBaCo+/3zMW91mNE0gMMAtijmHWplN6UARnVnNcfmcGttqxwxd0kW0
	 0tKQWp+dfGDbuql1wVmBR14hk9xMabclmJZH4cEtlFjEFuA3yLyKT9Cgsod+FPTT/xyV9
	 +zolQW+EV09QI8t+FfI/yPsAhdUNbckGpeouMJWas4AnCQoLK4TTYGUrerKcZALECmA==
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=n3VRUvKO;
	arc=none smtp.remote-ip=115.124.28.170
X-Received: from out28-170.mail.aliyun.com (out28-170.mail.aliyun.com [115.124.28.170])
	(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 301EB606A323;
	Thu, 12 Nov 2026 12:52:14 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 301EB606A323
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=1794487925; h=From:To:Subject:Date:Message-ID:MIME-Version;
	bh=KWl2nH8QGR76CCLtZk6bqGKfbZExirp/BPFDBGPTkYk=;
	b=n3VRUvKOwIzpuLc/YV1XH7nyFfNt6qwb2oGsjp24WiDe5k2/VFegqJJi+lECBNMRSoi8P0iVX/+JN1/ZjRm96RRuhJGTf4Mhq2E9GhTWXAp/PZB3m5w+8CuhtdkFXnoYJpJXDD86xXZxcsz3Z6t5qa48QmghnEHrK6oe2+hUroM=
X-Alimail-AntiSpam: AC=CONTINUE;BC=0.04498484|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.20549-0.0143386-0.780171;FP=3337311923600399844|0|0|0|0|-1|-1|-1;HT=maildocker-contentspam033025068124;MF=fangxy@xiaopeng.com;NM=1;PH=DS;RN=13;RT=13;SR=0;TI=SMTPD_---.k0cpdZq_1794487922;
X-Received: from localhost.localdomain(mailfrom:fangxy@xiaopeng.com fp:SMTPD_---.k0cpdZq_1794487922 cluster:ay29)
          by smtp.aliyun-inc.com;
          Thu, 12 Nov 2026 20:52:04 +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>
X-Mailer: git-send-email 2.50.1
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