🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14391

Re: [PATCH net] net: usb: cdc_ncm: don't underflow the NDP room check

#14391
From: Jiahao Xu
Date: Wed, 11 Nov 2026 04:45
37 lines
10561 bytes
On Tue, 2026-11-10 at 14:08 +0000, netdev-bot+sashiko@kernel.org wrote:
> [Medium] The code change looks right, but does this paragraph describe
> the trigger and the root cause accurately?  Can a second datagram in the
> same NTB reach this check at all?

You are right, my description of the trigger was wrong.  I re-read the
code and your analysis holds on every point:

 - cdc_ncm_ndp16() returns the NDP it finds in the chain when the
   signature matches, so on plain cdc_ncm, which always uses the same
   signature, the create path here is normally reached for the first
   datagram of an NTB only.  An additional NDP for an NTB that already
   holds datagrams comes from cdc_mbim_tx_fixup(), which uses a
   different signature per MBIM session.
 - cdc_ncm_setup() clamps tx_max through cdc_ncm_update_rxtx_max()
   before cdc_ncm_set_dgram_size() runs, so cdc_ncm_check_tx_max()
   computes its lower bound with ctx->max_datagram_size still 0.  The
   bound is therefore max_ndp_size plus the NTH header only, not one
   datagram plus one NDP.
 - In the report, end 0x140 = 320 is tx_max derived from a device
   dwNtbOutMaxSize of 320, and the 256 bytes already in the skb are the
   12 byte NTH header padded by cdc_ncm_align_tail() to the 256 byte
   wNdpOutAlignment that cdc_ncm_fix_modulus() accepts because it is
   smaller than tx_max.

So the reachable triggers are the device controlled
dwNtbOutMaxSize/wNdpOutAlignment combination, or MBIM multi-session
NDPs, and not a second datagram on plain cdc_ncm.

v3 keeps the code unchanged and only fixes the commit message:

  https://lore.kernel.org/all/20261111124156.637661-1-xujiahao@cmss.chinamobile.com/

The Fixes: tags you asked for are already part of it.

pw-bot: cr
Technical Details
Message-ID: <20261111124546.992581-1-xujiahao@cmss.chinamobile.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-360865-linux-kernel-netdev=dewy.ru
References: <20261109060913.526268-1-xujiahao@cmss.chinamobile.com> <179431970794.994134.5397680174063039863@kernel.org>

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-360865-linux-kernel-netdev=dewy.ru
From: xujiahao@cmss.chinamobile.com (Jiahao Xu)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: usb: cdc_ncm: don't underflow the NDP room check
Date: Wed, 11 Nov 2026 12:45:46 +0800
Organization: Usenet Network
Message-ID: <20261111124546.992581-1-xujiahao@cmss.chinamobile.com>
References: <20261109060913.526268-1-xujiahao@cmss.chinamobile.com> <179431970794.994134.5397680174063039863@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="776913"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:KzDwuHCCWvPSvIrgDdd0NChpExk= sha256:kT6v+ASi6MbUV/4n/2GtjTmGV0tGj6stRgiUFjeuwU8=
	sha1:nE/Njil4vnpo+k1FyZoVRPPZriE= sha256:WLjUfU5z1qWD84pjzhMMvPpCW4gs6Op9LA5B030J5U4=
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 9003D113E29; Wed, 11 Nov 2026 07:49:35 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.75
X-Spam-Status: No, score=-2.75 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=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,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=fail (1024-bit key)
	reason="fail (body has been altered)" header.d=cmss.chinamobile.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 osXhAFCjnMas;
	Wed, 11 Nov 2026 07:49: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-360865-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=cmss.chinamobile.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 96D19112998; Wed, 11 Nov 2026 07:49: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 E4CE165E51; Wed, 11 Nov 2026 04:46:49 +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=1794372353;
	b=Ki/ad4xsgymXF9EqhE/Dv0g3IH69oOeBTBNZNhiT30NB0xN8JpM2tadZnZC4ggStY3c7
	 iQgG7OsutHP1JSWp3xsHtniVTn1yw3aRMUPmu+WuAEsdPLLk0sotxqwKX4p4+JmmDpjq6
	 qslHypqU8z08/SOnPtOB1NLHLE+I3N7DG2s04JFfwNR5n4rx3WktT0vUlL28eVJmlDwud
	 5m5iAY1FK4OpscS2Or05w9eVYnZlbRW7IY32F7VYqrRk9p9nmaP5S5haEKKzhiOYPG2Ew
	 RLq2QTZ4jaCrTbRaBxHlX9C5XaWPXU4wvjsHDEKFhaUBAykSZiSLjpNMjkriLSTdx/Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794372353;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:X-RM-TagInfo:
	 X-RM-SPAM-FLAG:Received:X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:
	 Received:X-RM-TRANSID:From:To:Cc:Subject:Date:Message-ID: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=QihW/6Enmbr2pJagUmwIuHLjXObwQ7XXA7JRjeBMr20=;
	b=qPRptIO2eysy2kM3olrJIskzBkZt34T2XTZKtmAU+BBrh6n0PQgHOSeNGOEeNOHUa4s6
	 hn486l33OeReizhzKNq/necEkAQgqElFJcGlYNmc57owmr0ANZXsBdRB67L6+Jk+WZdJW
	 sBLpken09KJMuDFRLGK8RLbjTPE4/P2LzqMSCocVw7EJhgpN+vLTeFbVN+HGULgR+sQie
	 3GIFmbVoFa78RrR1kCF1yw6XWiUxrdS0QytRomhvrO1gyxZAJ1QVc6774EHYZrqGtmvHX
	 1zCpMJDTDmdxUZb1eSFzaD1WM8WCOZK3ZyOf7Lxj/bCcfpIbrBwY61YQB29ACcRecTw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=XmnuiKDa;
	dmarc=pass header.from=cmss.chinamobile.com;
	spf=pass smtp.mailfrom=cmss.chinamobile.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 50B26606A31C;
	Wed, 11 Nov 2026 04:45:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=XmnuiKDa
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=111.22.67.137
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794372352;
	b=LKGMzNjXLbPJMEwpTclQ+KohEbdvgIdykb99NV395Ar8vAFJKTFQ7Kn+JV7F4zX0ZHMw
	 GZF+kC6ejRyw9hMHH3aeadYoHoQCzGPyX5a9bS1g0id9ylVMpxzVsvtAKkJ/udK1+fgW9
	 yNNyfKwsYRLUUwYrkSK68BuRnKlKp1WOUQ+Rd43Q0WUSVpEFM+ttns4STrNCwTVukZlyf
	 Cf22vRN/0WwFq/r9gfpb9SBaQN05fBoHLWVwhjerPED/h7B+hI+e++oJXPPA3CAlyJKud
	 7dsddMolHTjjanGWLMwrEE1DYVHBwxvslvZvrU2EPc1zuhf1hxUTUyOH/bnGV0dNaow==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794372352;
	h=DMARC-Filter:DKIM-Signature:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:
	 X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:X-RM-TRANSID:From:
	 To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=QihW/6Enmbr2pJagUmwIuHLjXObwQ7XXA7JRjeBMr20=;
	b=s+lr9GKZzpu9AM1Z7W7Oz8/x1GFhmkBtgHjL7DJpBb+wtVgqSDA2HFdWPYnpfWcDklj/
	 2RFN9kOFe/YMD2fQcvnfHgBt6UZvpQVXv5mJXo7EcIerEZV23h1/cNp3uqqu3BGM2ODNR
	 92L93Sggia2lOVJ/YItmefpwsgPWCbOkL6BJf7KI7rteR0C4kMflVFt3Qg87dB/iqvjol
	 5u3Q9rtAA0cFDJ1XOSOThHt6U0TgxFx2uYcuDl02klG4yoOi4IT/kEVu9c14YDW/7hXH5
	 TMdMt6i+QI76NzQ4Sr90puaFB4l91/rF3qmFlpshPBB+B9DTlBvqWuTcxFN7I+ZOGgg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=cmss.chinamobile.com;
	spf=pass smtp.mailfrom=cmss.chinamobile.com;
	dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=XmnuiKDa;
	arc=none smtp.remote-ip=111.22.67.137
X-Received: from cmccmta4.chinamobile.com (cmccmta4.chinamobile.com [111.22.67.137])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id D7A7C606A327;
	Wed, 11 Nov 2026 04:45:50 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D7A7C606A327
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=cmss.chinamobile.com; s=default; l=0;
	h=from:subject:message-id:to:cc:mime-version;
	bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=;
	b=XmnuiKDa+irRScHJeAQ407Qg8eRyVnqZEtGyobhUKrQpvlj84Tdj8l1nIGosOQg6Cpn4u97cPaUhx
	 lV1h2S9yB2qHg1AQiZJeD8M42VyeFVTteRDLXOt6ETOwh/Csf3OfHP9e2a//UmQlkH0iQYvxn0onEW
	 /OHRR7IlsQCnANpI=
X-RM-TagInfo: emlType=0                                       
X-RM-SPAM-FLAG: 00000000
X-Received: from spf.mail.chinamobile.com (unknown[10.188.0.87])
	by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee46af3f2fd437-742bd;
	Wed, 11 Nov 2026 12:45:49 +0800 (CST)
X-RM-TRANSID: 2ee46af3f2fd437-742bd
X-RM-TagInfo: emlType=0                                       
X-RM-SPAM-FLAG: 00000000
X-Received: from [25.255.2.225] (unknown[10.55.1.70])
	by rmsmtp-syy-appsvr10-12010 (RichMail) with SMTP id 2eea6af3f2fb415-ce5b3;
	Wed, 11 Nov 2026 12:45:49 +0800 (CST)
X-RM-TRANSID: 2eea6af3f2fb415-ce5b3
X-Cc: Oliver Neukum <oliver@neukum.org>, 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-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, syzbot+1994e2ecf323ed90f255@syzkaller.appspotmail.com,
	Jiahao Xu <xujiahao@cmss.chinamobile.com>
X-In-Reply-To: <179431970794.994134.5397680174063039863@kernel.org>
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