🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #13712

[PATCH net v2 0/2] net: do not run out of frags in alloc_skb_with_frags()

#13712
From: Haishuang Yan
Date: Tue, 10 Nov 2026 16:24
39 lines
10445 bytes
alloc_skb_with_frags() can fail with -ENOBUFS for a data_len that passed
its own size check: it splits the tail into one frag per bit set in its
page count, and when a high-order allocation fails it lowers the order
without checking that the frags left can still hold the rest. With
vhost-net + tun, a guest that sends a GSO packet above 64K can then make
the vhost worker retry that packet forever (100% CPU, device dead).
Patch 1 fixes both cases; patch 2 adds a KUnit test for the tail case.

The issues were found with the help of an AI coding assistant.

Changes in v2:
- Patch 1: also fix the fallback after a failed high-order allocation:
  only lower the order while the frags left can hold the rest, else
  retry the same order once with direct reclaim (reported by the netdev
  AI review of v1). Changelog and test notes updated, including fault
  injection results.
- Patch 1: reword the comment as suggested by Narcisa, and compute the
  page count with DIV_ROUND_UP() to keep the line within 80 columns.
- Patch 1: say in the changelog that this only fixes the frag accounting;
  larger frames failing in tun_alloc_skb() are a separate problem.
- Patch 2: skip the test instead of failing it when no order-3 page can
  be had, and name the fix by its subject. Dropped Narcisa's Reviewed-by
  since the test changed.

v1: https://lore.kernel.org/netdev/20261108100617.23840-1-yanhaishuang@cmss.chinamobile.com/

Haishuang Yan (2):
  net: do not run out of frags in alloc_skb_with_frags()
  net: add a KUnit test for the alloc_skb_with_frags() tail split

 net/core/net_test.c | 35 +++++++++++++++++++++++++++++++++++
 net/core/skbuff.c   | 30 ++++++++++++++++++++++++++++--
 2 files changed, 63 insertions(+), 2 deletions(-)


base-commit: a45dbf182137275f44ad7c8bc8acd23f7af6b2cf
-- 
2.43.0
Technical Details
Message-ID: <20261110162418.28322-1-yanhaishuang@cmss.chinamobile.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-359959-linux-kernel-netdev=dewy.ru

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-359959-linux-kernel-netdev=dewy.ru
From: yanhaishuang@cmss.chinamobile.com (Haishuang Yan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 0/2] net: do not run out of frags in alloc_skb_with_frags()
Date: Wed, 11 Nov 2026 01:24:16 +0900
Organization: Usenet Network
Message-ID: <20261110162418.28322-1-yanhaishuang@cmss.chinamobile.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="558029"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:F4BHlj1qNORdwA0QoanPq7DRnL8= sha256:sJvckgkwpAw0Uk4wzvT+S1uDZcQe8UfjNNk+jJgk41U=
	sha1:WSi9BUJHRDDE/Sd9+Wjy3JAFsP4= sha256:A2CdtszbMnbh75MgnrBCqlbuTQ8xF30y2ghgslL8LGQ=
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 DDCF4113A96; Tue, 10 Nov 2026 11:37:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.849
X-Spam-Status: No, score=-2.849 tagged_above=-9999 required=6.31
	tests=[DATE_IN_FUTURE_06_12=0.001, 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 FCt7rDRlb8A1;
	Tue, 10 Nov 2026 11:37:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-359959-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 769AB1139D8; Tue, 10 Nov 2026 11:37:15 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id B6057662BA6; Tue, 10 Nov 2026 08:33:33 +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=1794299485;
	b=Sh9/03OSTVdweLfvYf/soYfqu/JjPJ1pE/bcn6cPjvzZnETw4Hc1v+7xSfp41G8bj2g1
	 b96gZSOAby4pdUyLOc2alWSd/duJNaiTzNQ/qhUw3iem4KKkFZuamQca7DVlDLUwBhPYN
	 4dNhmZ+1xLiPCIsUbGRZhv0LUlaJA/w4nZohUYH408H6u691lMHtyA2fMaUBFxZtzOOz7
	 0xhUB05bOjDloI/SJcy+B3ctZMLkikccdYQKGatx1KWXJrf73eaId3s1VGJ3v8SuUoSbg
	 Dj8P90lcHNRBuFUq9QtnP9rtkOIsjTs3icuEKk2jKirlKIED65oy37eS3G/rrk9xqDQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794299485;
	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:X-Mailer:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=VHS9PME+lj3sobM0nuC4YjIOUceVBhWAlwGY7ffSBGc=;
	b=4cB/V5Y9Ju8Un753xL2ueK525ebgsAm6HamWtnNF+cnOQa+3SYLZdEAm0khIbT57zkJS
	 2aV1OYODnBzB1jZxfFyMxYdaACu0foGCbDAWtt68I10EUk0Hy0jWIYpDESTsa3HJveQ9s
	 pWy0c9MWtTt5dhBRC/Ru3nhDPYwkQWURDqJl+FxyuQ1TMPO7wYGkWHrVi1MjTVIEACuX1
	 tHm8ByTuXBTRZ72+wWQwHLFyVxDepFc8Or39V7r1fEr+NrCNEkQz8j6uFwva3z54JHq3g
	 8jwG6wVyRZtBJKioPMwbc6Dtc9n8cIuyQwhX8lx2ehjuDHg/+nTtYyJHF/4sQc4PFgA==
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=IFwHx+tm;
	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 B34C8606D00E;
	Tue, 10 Nov 2026 08:31:25 +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=IFwHx+tm
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=1794299484;
	b=TLYvdrg2pAm4AZ6srXn0BkwCQ9RzyjhTSprcOaxbjuQVQOYfG/rsBPSn0eUYTVxJlBhi
	 c0Dc4x4Ou5XF8SOnA37L6meF81jpPBHe8++u9CA3+QvrXIwhnFZ4YCnZh0lIKfNZEvjXA
	 YUpYuiBaznDY+B3/Fn2ML9DVjM/zDu+hx2xxERV9ojFqwEAPnT5vzoe1DPIiGEewNUN9c
	 f4wk2cwbkFBCglwXoWQ8qXy0AF1qbv2/gdqeAXrhHIEw5EpeEaoIVn9mVIhrVAXATiCKJ
	 dKT2gXR40JEqmrtEo2CV2PE7PvHMD040L4qftEmEgcsBHeouQsAXB2fd6wvsOeQ6haw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794299484;
	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:X-Mailer:MIME-Version:
	 Content-Transfer-Encoding;
	bh=VHS9PME+lj3sobM0nuC4YjIOUceVBhWAlwGY7ffSBGc=;
	b=BTBWlW/9oTnJuj0zGBqUd9+wz36H4+v6vyt/OBfY3sWcJA+Gauf87/l8M7EVzIuRQLOb
	 Xc3DQXaba2RdGjLYMbUHNmrTXJtyOT1D9Bn2zOVInmHlmcFsYMOGywJ0FXXqcPzI9l5WL
	 NvtAc1LH0yN9yyYvC2O9C3riIywT/2VxxMu99Vpxc5TE0qPc1qPPcTK220XWzoTwmmMhT
	 OCbCllZRkpHblJNqiyg7xYwsKTSQ8L89+nggWBPitsuoJ3sKPb/phnwx35m7p5VGDOUCd
	 Ai8/3Y/KN1SHTnrD8aZcLODTKSFtXIeqh6rh5+D4dcD5UzdXiG4H6xphha9NwZ+Bgww==
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=IFwHx+tm;
	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 E0B13606A31C;
	Tue, 10 Nov 2026 08:31:22 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E0B13606A31C
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=IFwHx+tmQrcNrRL6FKEyzMhc5Oenr9Ply8PNTAAU0vfOt10CKaafguJHW2hycC+r46ubVjtSVvQtY
	 TLTQdGELmD3w0ZSbWI8sGjbGqjPepkLonbz8cDox5b8RcLcMU9tPMsP4wr26neMuPPgx2nu9bg3yiu
	 coz2Hyn4nPNzPOjU=
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 2ee46af2d659e64-6cc7f;
	Tue, 10 Nov 2026 16:31:21 +0800 (CST)
X-RM-TRANSID: 2ee46af2d659e64-6cc7f
X-RM-TagInfo: emlType=0                                       
X-RM-SPAM-FLAG: 00000000
X-Received: from openEuler-24.03.03 (unknown[74.82.203.40])
	by rmsmtp-syy-appsvr07-12007 (RichMail) with SMTP id 2ee76af2d6503b8-ae19c;
	Tue, 10 Nov 2026 16:31:21 +0800 (CST)
X-RM-TRANSID: 2ee76af2d6503b8-ae19c
X-Cc: yanhaishuang@cmss.chinamobile.com,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	horms@kernel.org,
	almasrymina@google.com,
	daniel@iogearbox.net,
	willemb@google.com,
	willemdebruijn.kernel@gmail.com,
	mst@redhat.com,
	jasowangio@gmail.com,
	eperezma@redhat.com,
	narcisav.kernel@gmail.com,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.43.0
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