🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6012

[PATCH net-next v2 04/15] net: skbuff: fail segmentation when a segment can't be checksummed

#6012
From: Josef Bacik
Date: Wed, 21 Oct 2026 13:46
51 lines
13650 bytes
When the device can't checksum the protocol, skb_segment() computes
each segment's checksum in software with skb_checksum().  With SG on,
the segments share the original frags, and a devmem TCP skb keeps its
whole payload in unreadable frags.  The devmem MSG_ZEROCOPY path never
sets SKBFL_SHARED_FRAG, so the __skb_linearize() fallback is skipped
too.  skb_checksum() then warns and returns 0, and tcp_gso_segment()
writes a TCP checksum that doesn't cover the payload that goes out.

That's reachable with tx-checksumming off and SG on: sk_setup_caps()
still gives TCP SG and HW_CSUM, so the dmabuf send is accepted, and
harmonize_features() strips the checksum features but keeps SG.

Use skb_checksum_full() and fail the segmentation with -EFAULT when it
can't checksum a segment, as skb_segment() already does when it can't
copy one.

Found by the Sashiko AI review of an earlier fix for the same path with
SG off.

Link: https://lore.kernel.org/all/20261009-b4-skb-segment-nosg-unreadable-v1-1-7e2334a55fe8@toxicpanda.com/
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 net/core/skbuff.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 40d2dd20d47d..88ed2dd99dc0 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5239,9 +5239,13 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
 
 			if (!nskb->remcsum_offload)
 				nskb->ip_summed = CHECKSUM_NONE;
-			SKB_GSO_CB(nskb)->csum =
-				skb_checksum(nskb, doffset,
-					     nskb->len - doffset, 0);
+			SKB_GSO_CB(nskb)->csum = 0;
+			if (skb_checksum_full(nskb, doffset,
+					      nskb->len - doffset,
+					      &SKB_GSO_CB(nskb)->csum)) {
+				err = -EFAULT;
+				goto err;
+			}
 			SKB_GSO_CB(nskb)->csum_start =
 				skb_headroom(nskb) + doffset;
 		}

-- 
2.55.0
Technical Details
Message-ID: <20261021-b4-skbuff-bug-on-followups-v2-4-2aa780a03524@toxicpanda.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350029-linux-kernel-netdev=dewy.ru
References: <20261021-b4-skbuff-bug-on-followups-v2-0-2aa780a03524@toxicpanda.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350029-linux-kernel-netdev=dewy.ru
From: josef@toxicpanda.com (Josef Bacik)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 04/15] net: skbuff: fail segmentation when a
 segment can't be checksummed
Date: Wed, 21 Oct 2026 13:46:48 +0000
Organization: Usenet Network
Message-ID: <20261021-b4-skbuff-bug-on-followups-v2-4-2aa780a03524@toxicpanda.com>
References: <20261021-b4-skbuff-bug-on-followups-v2-0-2aa780a03524@toxicpanda.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="4157017"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:he6pFtI7pGmW4zx0VsmpN6gPF9k= sha256:DP70fgUFcaZR2+nQexMjAYMEmNo87Zzz6fsATul7Hf8=
	sha1:bn2CI6fZABu1JsVkioZ8dEXYVEQ= sha256:wuBAm0lGFyMgaeFh5Azr0EqI0+M8y0cx4QMVRXdRDRA=
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 97E75111017; Wed, 21 Oct 2026 16:48:14 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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=pass (2048-bit key)
	header.d=toxicpanda.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 JiTHq1n0_v5g;
	Wed, 21 Oct 2026 16:48:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-350029-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=toxicpanda.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id BF14911100F; Wed, 21 Oct 2026 16:48:03 +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 2B0606145DD; Wed, 21 Oct 2026 13:47:30 +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=1792590436;
	b=ev+xMVdbfhO58+hxwcK6fnF9xgdkzLiuRsU8O41OicvvciI7EzK0oZMBCz95q9u3Yipg
	 qJv8tdzw+HdqJ9f3XPv/AftAUG4+2YOQWrxSgf9tCJr5NOMoY7Wrai9YxRYMiX2rSKLcQ
	 HmkQwLvLAm51HZskyXORpxv0kk+RLIm0Z8CV48K2G00oZalmVxGbSEQHpnura4OrxbbAs
	 bLrW+PJblPT2iIyXbkm2AADGItOeYwqgu/kmCBz+3k1N79YlQeMdq2N85WBknLdtI3SjI
	 R+7tcYZiM2zzWsoUMyfsxdOh3kCYGUwysf+FaPy7TJBWa/Nan0NiFjfA9TJnSTYiA2Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792590436;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:From:Date:Subject:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding:
	 Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key;
	bh=2aRCuku2oKEDF0Op1/pBMZnZUn6snlu290Nklz94qvM=;
	b=3S17cZ+rv8QheXaHV/Ta6Iny5UDslO0Tks9Qfr+kAuYdZIWhzkxzs29PF+v4OBcREiFO
	 KkfnOQoU+TmIO9ul2mrUGuIUNBH8RbGOs5DyD5QnlVOdOWEMvW86EBPbEqxr0HhLlQ+D0
	 kSwETOmIHR28BYlicOlLLQhdZ6FpbP8Ue8o9DoR7EVsk3Vt1UluSn2Lh9wFHyztlvq0Ul
	 cDv/H2nCFbA9CS/yaEcoIi8b99v80FpGYNWsljy5V6hZ+ZISbIpRzi+wlYITeCBler38S
	 GzJQRfcbhRzTNHAcMSftBcAsV0eyySVPYDF27cV/hbSg7/90YGk4eT9ls75dhF4Ee4A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=toxicpanda.com header.i=@toxicpanda.com header.a=rsa-sha256 header.s=google header.b=XBcZ0cHs;
	dmarc=none header.from=toxicpanda.com;
	spf=pass smtp.mailfrom=toxicpanda.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 DA6B4606A32F;
	Wed, 21 Oct 2026 13:47:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=toxicpanda.com header.i=@toxicpanda.com header.a=rsa-sha256 header.s=google header.b=XBcZ0cHs
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792590436;
	b=Qnma1L02GhgO9J5kZXjQpkxaYZdBVV2MobYcfxCMryUgT03iqxiIXmB/GPciESDDpCe5
	 nBIkJoy7VpQ8q7qw7B2SOlciFW74+QIsb5pqtI8l+1FhPcC2PGGT2dYxDZXDjkx0++qCV
	 zD0ikKTej+h3ZBx9nhTi8soXFbovKzh8lnoItmhZxGapLa2uiCfcuFT4W57Bb+Bl50O71
	 /GWSHHFli8LKNe7ZoqctBzOw+zuh8KEPHdWHqIA+GD+psElfkU7n0oKzas+rhTg8fCnZT
	 jqwADHd34ybs16Z9P9B2FNSlkdOPNBnqJLh+LU2Wgk0Jpu4B0k02AFxvh3wWcZYhujQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792590436;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:
	 Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key;
	bh=2aRCuku2oKEDF0Op1/pBMZnZUn6snlu290Nklz94qvM=;
	b=3jULJeAFu+1YZ2+BJGBzVgZZuVnDNGPy2bH+Nrt3DS8q1njaLVWm21CTcaR7K+Jcx7ry
	 IEbSHim18AgLnJXJctbxevDhuJh2pq1vsohcYBocuePY9ULnUM7j7GvmFkeX44I1qzqkQ
	 K6aYyCxseKuLyzvf5/a7DdnCqfBOKUvfg7eSYqQT25ql2tjirDtImq9rP2iaYyeKB+zKC
	 6Zz64eE874k+RzchQGOEXRsr/trSjc5BrPTKOkocW8G8HQogkLr5CCub751ulqPDKN0OD
	 FkV4rCK8NauujEStqdvKZuDwraCxaKFz+X1rD0jRynyYveaSt9j6g/BceXvWG/eiPAg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=toxicpanda.com;
	spf=pass smtp.mailfrom=toxicpanda.com;
	dkim=pass header.d=toxicpanda.com header.i=@toxicpanda.com header.a=rsa-sha256 header.s=google header.b=XBcZ0cHs;
	arc=none smtp.remote-ip=209.85.160.172
X-Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id A05A8606A31B
	for <netdev@vger.kernel.org>; Wed, 21 Oct 2026 13:47:15 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A05A8606A31B
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toxicpanda.com
X-Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-534e6545939so5844061cf.3
        for <netdev@vger.kernel.org>; Wed, 21 Oct 2026 06:47:15 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=toxicpanda.com; s=google; t=1792590434; x=1793195234; darn=vger.kernel.org;
        h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
         :content-type:mime-version:subject:date:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=2aRCuku2oKEDF0Op1/pBMZnZUn6snlu290Nklz94qvM=;
        b=XBcZ0cHsbD3wjSJ41+HTbGpSMbdy0qo2oyFSyW3HL8OBpHTPobyMDhObfjnAZa1Sd+
         OfheMl6sVbdfFFNYZk5jTuRF/UCvhnxovVJ4LvTe4jkkFy5HnoixHu9BN5vtBCxIuNv2
         6JdeR+4Vp874zgPrDuwyK/xKZLe5U7og6AgGTaK9MaC3adSkECJaQIrUmkdSnbWNp/ZK
         PsH8CiW7duX7ZGkFRpHOxYVRorcHwTp/9h2urQzjgsccdNlbx9p7juOVSdqbrc4k8tOl
         UWXgaQHnmA/0+uhoFuesQ954RX/J4izQA4gLdp+7UmVW0+uQtLR0uB0hIq/jS6bfFqJ0
         HGaw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792590434; x=1793195234;
        h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
         :content-type:mime-version:subject:date:from:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=2aRCuku2oKEDF0Op1/pBMZnZUn6snlu290Nklz94qvM=;
        b=IREazmkPHBmEbTdGNzAeI/SMLsceM+XktPaMrkuypD8r8rNXHk9Hu1/sKEmsmEpUWq
         CZQXwJJ5KxuScX/QeOXv/J3baW+CEgrWmtBJubKgs7JQCM7sr/SiSW446y9lQBeeaxHO
         hy7tJxbZkEvmXxVqhnHwk7xYRj3RkUaVcWBaszT+yJMk3DTPoZcY3uTYatvh9MdYPkZD
         TWK5np4z8VLmwcVx4346Ks9xOKzTDb8H8dpgUid9lfY0/VE9NCf4V1wRJp4+mbHtKNYq
         nU36tSyBxEeL19BWohbFTjOXEhAxmico56xYPRz9SXhc9APHOQ1S5C9zNsxEwriRkeyI
         fuNg==
X-Forwarded-Encrypted: i=1; AKwUvBziCBU71JimJ2TXhbH14b6mDRVasAQBwiD7a1HQvaWPGqENdndHzOlqQ6M48cHvcJSG3bsFz1I=@vger.kernel.org
X-Gm-Message-State: AFq9FYJLVEmlrZeg09kpbQPmZ7Orr5cxxSPR9QaWfik5jPc/FEpyQu2t
	xxfRq2Olhn+TPrRtW70Jot1VK2yQIDH9qgBnw2rl1BIW7q/ksiaBonA+osLswYuhrGQ=
X-Gm-Gg: AYBFou2+L7Yuc/5ENM90jJm3/C6ZWI1U9HbGqp9wB24iSrhxJH292sfVqXUNxvsXnLT
	jkAcP9+tiYuAgiL1MWQBBgzBA7Jg1NdcyHzr9GSOl8U8kfe7lVDBJJIjms64MQhK0dPyGCYsWWq
	PueldImqeC9j2xNKsv29RuSPXgsjGEGj8Tmm/lAZYamX9bN1vo6obnMhgFl0XLKiWXr92BrG83G
	iHcBanxS16efcb24XvO4XEyi497pXZI8uHJVYkI4x4/vsxiMlbxVquS2TSdXVhPG2a8Ljgvnbzi
	Y6DwhLAV40Ri/718zud8EI6/+SMhXVxWEigAPHRyhVUNTChlgpR0mFS4dnQMkTnLrLjoVTLB10F
	SHClWznbYecnHAjZB9xRHxDjA3XC4mmORgm42276tjKFTY4F08EAyGFcAbDaWJR/IauQKfQuKeK
	y/ToVBmIHaaytLupERxEMVf2eRFkNPMUK+O6YEoqWd2sD7YXsWqUBD5qw+KEhkzuol//N/gg7bq
	/cGBC74tGWw+YvH85LoihXeNCFsKqRjmd2jTLsp1A79bZGThEzrgKvHlaMOylLG7dGO4AIf
X-Received: by 2002:a05:622a:400c:b0:535:baa:a78d with SMTP id d75a77b69052e-5369b4f46c6mr30150331cf.10.1792590434551;
        Wed, 21 Oct 2026 06:47:14 -0700 (PDT)
X-Received: from toxicpanda.com ([153.61.196.248])
        by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91c10baeadcsm25487476d6.19.2026.10.21.06.47.13
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 21 Oct 2026 06:47:13 -0700 (PDT)
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
X-In-Reply-To: <20261021-b4-skbuff-bug-on-followups-v2-0-2aa780a03524@toxicpanda.com>
X-Cc: Juergen Gross <jgross@suse.com>, 
 Stefano Stabellini <sstabellini@kernel.org>, 
 Willem de Bruijn <willemdebruijn.kernel@gmail.com>, 
 Fernando Fernandez Mancera <fmancera@suse.de>, 
 Mina Almasry <almasrymina@google.com>, 
 David Laight <david.laight.linux@gmail.com>, netdev@vger.kernel.org, 
 xen-devel@lists.xenproject.org, Josef Bacik <josef@toxicpanda.com>
X-Mailer: b4 0.15.2
X-Developer-Signature: v=1; a=openssh-sha256; t=1792590422; l=1895;
 i=josef@toxicpanda.com; h=from:subject:message-id;
 bh=wii8wzXlG4ePvSd6K5rd8H498XoB8iUyEaQEAS7r5bk=;
 b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgUBr36M/n0nWN0DNbnxwzIiCZez6MG
 JiruuNaSCI/zXsAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA
 QFXNkJVl00uSWJUSJGE5ur3ZFVCzw0/41zwWUKiPaUfI51HMPUlDfMqmqTrCEh6QYjM2gM13Our
 wstomOnSWpgM=
X-Developer-Key: i=josef@toxicpanda.com; a=openssh;
 fpr=SHA256:C8kOX2QUJCMqnCX+KEeoqRAjLo9L+ELOSH2NSAJHqGA