Article View: linux.kernel.netdev
Article #6120[PATCH net] net: fix frag_list leak in skb_segment_list() error path
From: Eric Dumazet
Date: Wed, 21 Oct 2026 16:18
Date: Wed, 21 Oct 2026 16:18
49 lines
9233 bytes
9233 bytes
skb_segment_list() detaches the frag_list from the head skb and moves
its members one by one to the skb->next chain. On error, err_linearize
frees that chain with kfree_skb_list(skb->next), relying on the members
not yet processed to still be linked after the current one.
This does not hold when the current member was shared: it is replaced
by skb_clone(), and __skb_clone() clears ->next. If __skb_linearize()
then fails on that clone, the remaining members are no longer reachable
from skb->next nor from skb_shinfo(skb)->frag_list, and they leak.
The skb_shared() error branch already relinks nskb->next to list_skb
before jumping to err_linearize. Do it unconditionally right after nskb
is added to the chain, so every error exit sees the remaining members.
On the last member list_skb is NULL, which still terminates the chain.
Fixes: 53475c5dd856 ("net: fix use-after-free when UDP GRO with shared fraglist")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Cc: Simon Polack <spolack+git@mailbox.org>
---
Bug discovered while reviewing at Simon Polack upcoming patch in
skb_segment_list()
net/core/skbuff.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index ab178af02a2262d65175daff7f093c85eaa09c92..beddbf6812b9f387672c7ab5f0a1c07ab9bd0806 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4734,10 +4734,13 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,
else
tail->next = nskb;
- if (unlikely(err)) {
- nskb->next = list_skb;
+ /* nskb may be a clone with a NULL ->next: keep the remaining
+ * members linked so that err_linearize frees them.
+ */
+ nskb->next = list_skb;
+
+ if (unlikely(err))
goto err_linearize;
- }
tail = nskb;
--
2.53.0
Technical Details
Message-ID:
<20261021161858.761205-1-edumazet@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350147-linux-kernel-netdev=dewy.ruShow 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-350147-linux-kernel-netdev=dewy.ru From: edumazet@kernel.org (Eric Dumazet) Newsgroups: linux.kernel.netdev Subject: [PATCH net] net: fix frag_list leak in skb_segment_list() error path Date: Wed, 21 Oct 2026 18:18:58 +0200 Organization: Usenet Network Message-ID: <20261021161858.761205-1-edumazet@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="9747"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:9X6a/XiwaaxM7La6N5VZtJs0XiM= sha256:gcyAIiwL4hYDIFnMKl8hW989W90gRiiDnLmatbuMDQY= sha1:CiIB7CmoZdWUgQJQeKBNUdpnfBQ= sha256:tXKbbjhdRjGn+8a4EAhujw87nSZf7y7BhvlVeNsnYZk= 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 C8E9B1110A4; Wed, 21 Oct 2026 19:49:32 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 xGFIUW6il9Ji; Wed, 21 Oct 2026 19:49:29 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-350147-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 17DE21110A1; Wed, 21 Oct 2026 19:49:21 +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 4E1E92FC1E; Wed, 21 Oct 2026 16:22:32 +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=1792599544; b=CfLaDwF/qlb3m1O+W6/Un7+wv+lLlnrIrw3M9MoNFyxm6U0qJk1khxdPPPwk3nNWwrTh gdnU3V3gPZDwapo5ctI39SpKdXKVFbodp0x1H8SQMVVm590oz55weit6p/nGtu0fRRWVI UpPDuCeBMhW+ElLfiYh0OajhPmBZK34LVYd3XnRKI65rTDdNOLBe0EfGKiBch40MYfuwO qa4UeAsFTOw6TWDDoEoGANZ+RvvnT5bNupjYQjZFrZu8rjFaIP69ah9LlJxDgCuFHA0Pr tPdBRbtu/NQHdinq1QogQseNGKMMFYlJhJBuoF3UBtSu1dbUXN406MQcQUHokxuuzUw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792599544; h=X-Original-To:Received:Received:DKIM-Signature: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=bTFRat1kaLwkzHwyX2T4Q0ifC4xWLlRMWhFMUR5V6Vo=; b=lSO4HJgiFb/3jU6aGh+yEnyoyPNOKQfmpPgmkx2QztaVWewOg+ov+lF7z6LIVVFtjN7x BGp6YBSDp7gmBV136FpQv/defOosY96qkkEjIrmXLO/mJ8T2Ba8rhLRUoYSxDLZF3IsS0 z6jzQfNFMzN5dacyfkP8YLKuu0EHLofLtM/o3knB0OWaPJkpLbZ0vOlGoxXwflfLIdLtV eUz8Suo0LaL2kFxf0CDszmsmlfmXHepdpSWMh+rWOoAPahslp59ELmW5ftaFz2jTCyMOQ ZpiJHmi6bMeyHNI9hVEm1XTqNWgutZ+jaczipFjHlZrXuXlyIv5WiXdOtzglgkZ8VHw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=A8BrN0+C; 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 BA930606CD4D; Wed, 21 Oct 2026 16:19:04 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=A8BrN0+C X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792599543; b=K1H46L+wnhRkQ2CnL+58mLacNsA3za9XyziVXFEyIUgUtEsjaGvQHazlR81Q8L7fe54p XvLpMQ9zK2YVmioSxW83xA6zyGK/nJDWrwFArSEuN6K/Gq9Y24rZhQ1nBwQe5miNJo9wj cSZrnWNQLUu6FSRYo6hEsYNuCWyVbGYNqqgozOssrRavKRMgVkRFKieVwpFnLxriRUNG9 ApGvQpdZl1HIUExCiY37mUcWbO+oxNMUptv+IMmAoZznO7cwSiqVyDXIEUMu6okWMdM/h NwIihgfOS9bSrXrDT08/mQiPbrMLoiOnVEm63UbG+OunxVj57x8SGzAXRRTMTQ+IQGA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792599543; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=bTFRat1kaLwkzHwyX2T4Q0ifC4xWLlRMWhFMUR5V6Vo=; b=WnjgwulLeZ6GRLC5zZ0ZgQgywODjG6t5sqqhjTQvB4dorIlMtQU4cdJjJFCvn4nH6i0f G4/nXFfONo7Ko1HM++tqBLlHEmiu4wZBtuwYvvFQ/p6bSWA3VpMvjJyONTXg7jPh/htWP YHKrI/LUA2GIWbth6SC3ExsYRMXpGESLXiGl4fXQOSl6WOhiYkmYxiASxq05BWR91rvri txpImaVDskAwMvTavvwzOCMiq1CKOzy7STea60PeCpnPiYOT3+FY7UYLiXDpvPaYBQBwk wRprm5UIvDHsjAKfP0wlV4VOreyG7UpAq4Lv/Y2jMG9QziVXc9rDo/wtEI/wheaA9ZA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=A8BrN0+C; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D15A606CD48 for <netdev@vger.kernel.org>; Wed, 21 Oct 2026 16:19:03 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37E9B1F000C1; Wed, 21 Oct 2026 16:19:01 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792599543; bh=bTFRat1kaLwkzHwyX2T4Q0ifC4xWLlRMWhFMUR5V6Vo=; h=From:To:Cc:Subject:Date; b=A8BrN0+CDRoMuGopTTf1X6xk9hveMjKm2Ea7dSzSMb/F5srby1HRL2JCQHqCoNFT9 knrbUu9ymOAXLxLLhK1s/cLOUxHsZcnHC8AGHZN36v39dVLgzLOlAnhETSMCrs9L8S 45Z0LNP4Qtx5/SsQ2+wU5sPmLyCeWdTXK5DcFhROoC9qNtJkKXcyMM5b/q8mz3h4VR +nvTeFr2o9WGL9bKZOAim34eA/pEDEMV8EOMRuETRJSYu6HFRjyab7SbmHTSG2tQuI Ve+J5mrq0QGj/Q63GXKjlRPLswzGV1p237BkMruYiJvmLz9GDsRksz/GS23YnQ1Fo5 LteTEI8XwvZow== X-Cc: Willem de Bruijn <willemb@google.com>, Simon Horman <horms@kernel.org>, netdev@vger.kernel.org, Eric Dumazet <edumazet@kernel.org>, Simon Polack <spolack+git@mailbox.org> X-Mailer: git-send-email 2.53.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