Article View: linux.kernel.netdev
Article #19774[PATCH net v3 2/5] net: wwan: iosm: validate the ADGH datagram length
From: Fang Xieyan
Date: Fri, 20 Nov 2026 10:55
Date: Fri, 20 Nov 2026 10:55
41 lines
10234 bytes
10234 bytes
ipc_mux_dl_adgh_decode() takes adgh->length from the device and hands
adgh_len - packet_offset to the network stack as the payload size of
the cloned skb, without bounding adgh_len. A length below the header
plus its negotiated padding wraps the subtraction, skb_trim() keeps
the clone unchanged and the stack gets the whole rest of the block. A
length equal to packet_offset yields a zero length clone that
ipc_wwan_receive() still reads skb->data[0] from.
Require the datagram length to exceed packet_offset and to fit into
skb->len, and drop the block otherwise.
Fixes: c34ca4f32c24 ("net: wwan: iosm: fix incorrect skb length")
Cc: stable@vger.kernel.org
Signed-off-by: Fang Xieyan <fangxy@xiaopeng.com>
---
drivers/net/wwan/iosm/iosm_ipc_mux_codec.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
index 1c5aae25f08f..341c58b851cb 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
@@ -473,6 +473,15 @@ static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux,
if_id += ipc_mux->wwan_q_offset;
adgh_len = le16_to_cpu(adgh->length);
+ /* The device supplied length bounds the datagram. It has to
+ * exceed packet_offset and fit into the received block.
+ */
+ if (adgh_len <= packet_offset || adgh_len > skb->len) {
+ dev_err(ipc_mux->dev, "invalid ADGH length %u, skb len %u",
+ adgh_len, skb->len);
+ return;
+ }
+
/* Pass the packet to the netif layer */
rc = ipc_mux_net_receive(ipc_mux, if_id, wwan, packet_offset,
adgh->service_class, skb,
--
2.50.1
Technical Details
Message-ID:
<20261120105559.54519-3-fangxy@xiaopeng.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367885-linux-kernel-netdev=dewy.ruReferences:
<20261120105559.54519-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!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367885-linux-kernel-netdev=dewy.ru
From: fangxy@xiaopeng.com (Fang Xieyan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 2/5] net: wwan: iosm: validate the ADGH datagram length
Date: Fri, 20 Nov 2026 18:55:56 +0800
Organization: Usenet Network
Message-ID: <20261120105559.54519-3-fangxy@xiaopeng.com>
References: <20261120105559.54519-1-fangxy@xiaopeng.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="3138713"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:/C0C+R1pAgWSKoAemPU8HNmMtLk= sha256:0ffO3W8hm4qHVjBEo4sokXeRLTriC/4saA86meJsrgs=
sha1:boETuf8Ux6KWs1s4Rc9kqWv5Lm8= sha256:urc0Eq+BRGvc0QlLDXVOk5hW4cFnXagaSQG2639lZNU=
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 BFD6C11596F; Fri, 20 Nov 2026 13:56:34 +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 Ip5iKclTEUHh;
Fri, 20 Nov 2026 13:56:31 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-367885-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 80CA111596D; Fri, 20 Nov 2026 13:56:22 +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 5F337106AC0; Fri, 20 Nov 2026 10:56:20 +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=1795172174;
b=P4N5I8kD6p/FOm7Ogp2ma1yG7VWcJqSM0wBTXrus+Vv+sNPBfM/syJgNrbXJszAp/CWE
lNR4amUCDv46mt6NBq5fG3qRYkGFeyg1GkTuWpHROS3NLVoUWBUHYoD6dLbsvTmiRZ3ej
DiCRYt52IYFk+pDysE3EZje6Pe7iCbr4m9VrcWM+zp6tnNLKJTlDH1YHQ0ynsNIvovTs7
ww9uN05gA9yhoRckEPs0TWf9do3jZGtn4E8n+jvxlXtmGK8dwMQnNJLmOkugJ6gmHoj7l
yVHX2utxmb5+V8TMnG6sZhfpO7rvSbqsuY+HwSvd4y88G2iNxp8mgCCCjJkKYAp+5Gg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795172174;
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=YNmhIN96G/XaUV9fy0P9SjX0B+4zL5Q0jDqnNZEKxz8=;
b=wn+GoNSbMHB9WhRgBq51gtPIDhpXY1RjQPgdv6E868ND04Si3fF0ZP7/sj32u9bBOlFs
qjGet/qyBBles5MqAQSk4V78L6a/IC/cIFs3IjESgU11sl+PEQHLYUZ549q8vpfjNNSnW
9HhKCwr/I4un3/wrq+v6OvTbxY47jnUG4rgJ+zdVz+vT4AZcrBqaItrnhCteKA7BKxBp3
Rx9KRRErMG7Wiqu1DBO70yapAyq2jIWWZDogXZzDd3zKzUPDfeKAM+8exaa6aA4FBJLJX
1ZprhrIlI1WQ8S8/xio4izS24159fkG8CLB+iqrE+H3vZkN2Ype7tcpkQhJe8mRPdfg==
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="FtyeK/CD";
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 A50F360A261A;
Fri, 20 Nov 2026 10:56:14 +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=FtyeK/CD
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.28.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795172173;
b=iEIlzVROmsFoaEQYpzhKcevLLvqVyFnJW5rIcTf25kjPwPHLPmRErf60y+lYMknGlDpU
JbJYJu/e65zRJkyGtdLuFDYCk0pnqqaEzNYBcbngwOoxF7qhQW/ppuzxjHnWOBfDKMDgC
nUnqskeEmgoAMHn/vsvHIkQhu40LSamvM/bS1lrATfHeWSaaKgeAsa9GcNazA3aTwBC2a
fVCxgwYfugCpr5TqJ7+1LURYdu0wlxt9t0ezI2VDNy7S/Lvg4OJY/HGboBNp59eG9rPS2
J/VFgxqaKWDHnw705r9ifZHkE/CSBMmqzIgw/mANXaWQZLyop03/kr2DjUFF1hAANqQ==
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=YNmhIN96G/XaUV9fy0P9SjX0B+4zL5Q0jDqnNZEKxz8=;
b=ByBM4cbPK8PBjReRskCfR55VnWAMaf9PPpbv8AIW0+JDcsQKnMS8od9DOczq5cgERmNt
bkU3uhmrzrmh/C/rgg4pspuDMRNiVdc5t8Ha5Q/gKMqNZK8teLze3uoTM70YedvbTArMQ
DQ3Q/GTL9koHtsiGuGyy/jH4EUuch9oCae20i6iAX3R9Kbpf85qruQcbYP6m4gPTD7vJi
DfqOL6kqu/7YdS56mLX6Z0dXSsg3smyOxqogso1vwBDylLfKNyJRJ4uITmt2hp1lCqaRZ
C4UNakV12MExL003t8MvgRf/ve/4lGR36FrEMB/YPdF1nhm85CYw3ElCZucPy7ZeKhA==
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="FtyeK/CD";
arc=none smtp.remote-ip=115.124.28.172
X-Received: from out28-172.mail.aliyun.com (out28-172.mail.aliyun.com [115.124.28.172])
(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 08B30606A336;
Fri, 20 Nov 2026 10:56:11 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 08B30606A336
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=1795172164; h=From:To:Subject:Date:Message-ID:MIME-Version;
bh=YNmhIN96G/XaUV9fy0P9SjX0B+4zL5Q0jDqnNZEKxz8=;
b=FtyeK/CDxXGxyy4cVKK8fg6EjqsRODDOWLoHqZEFx/s+CI6y3seEM2e3r+Jc+W3XtTD0tl2HWFaSoIaXRZAqowXpIFuXpoB/r0zLZhuOetCF01EpUCtMawmNcoWN5fFAsLfVbAqndsRw7M62ZabXlypc3cS3co7HekMobryT2gA=
X-Alimail-AntiSpam: AC=CONTINUE;BC=0.05407562|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.00349499-0.00128547-0.99522;FP=11300766904079126240|1|1|4|0|-1|-1|-1;HT=maildocker-contentspam011083099174;MF=fangxy@xiaopeng.com;NM=1;PH=DS;RN=14;RT=14;SR=0;TI=SMTPD_---.k6Wwa33_1795172162;
X-Received: from localhost.localdomain(mailfrom:fangxy@xiaopeng.com fp:SMTPD_---.k6Wwa33_1795172162 cluster:ay29)
by smtp.aliyun-inc.com;
Fri, 20 Nov 2026 18:56:03 +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