From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379048; b=qrXeyfUpYWbmXlSGVRkxSysrh9uC8+RALBuximLzEgFkNg6r0vO+yaK0P4P9WlxKdQDX PARdFNwBPNdoOhaegyqFdIO79R2l/GxMYBFvhXYROxfnjiJApttHtxa5lG6F+eoU68rwJ RwvNbIsKew8Mng3riZ0mkTyeT8rO8qBw1XeyCSzpgStLQVA7c6EHdc0usl3dZ/+d8F+az CCJrkQsvnD58sIWkOEOccSjTx7YhzB5+7S8eWbegQSwROBIpT7uzJ8zeuNTaC6Antljv+ khsJ4tCLd/O2pfFUKPG1PvdKzDrJyi6POviY7MR9mue3qm2D0OgwevI437VM7leBT7g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379048; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=LmNbdENgf84QQlhikcbig0Bzyudxt+ft39IxmnyO8xY=; b=akiO4csX107KjgQpM5Ol0FEiXrsDhmsT+ArCzamYpohJWYj8M5x6rEZjeAX/988KPOs6 c9JZnEi0MVz70Bmsra8qRAZgabNhNktg7/+SBIsZLxMF/oIXkUNUqExJtBlYg5lfkvV/g LJRRTlJD8qoZjuLkissBz/LunpDTGJgvUT+mCjzSyWzrIvEGLUvuB4pDyXt6/G1hZAjYF nJHzGKJemNV+CsSVmpsR3T4v769N21ThjN2EOr64dlU8rhF7b4jIuIFE8UMpC7QE/+rao XN8zDafvTWPFxPuCnI2JLEdjH+RhhBlQ3cv7SPdmjGeAU/sarhtM6I/jqrD6iCnLJeg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=1DadxbFD; arc=none smtp.remote-ip=100.103.45.18 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 D4BB4606A33F; Fri, 4 Dec 2026 10:10:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=1DadxbFD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 186C71F0092C; Fri, 4 Dec 2026 10:10:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379048; bh=LmNbdENgf84QQlhikcbig0Bzyudxt+ft39IxmnyO8xY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1DadxbFDsqt4bXj2dwK4J4oS0IFJg19g6B5ftkBZgS4mJ3KaPUOp0hAsyPVhcR99J blBnMcwVkK85Q6iyn38vPxKsXktdzT+b2PcLAvbZlV1GduoRc1uam1+4ya/2Q6RqE5 F9K17I5FsdpVYGtjUMDixtiKPqVobK4Vly2ggWN0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrea Mayer , Yuya Kusakabe , Justin Iurman , Gabriel Goller , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 001/555] net: ipv6: keep room for the mac header in dst_dev_overhead() Date: Fri, 4 Dec 2026 19:00:44 +0900 Message-ID: <20261204100604.036793977@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuya Kusakabe [ Upstream commit 87cd6b717e4069dca34e0866e57eaeb44d3b173e ] The seg6, ioam6 and rpl lwtunnels size their skb_cow_head() request as the length they are about to push plus dst_dev_overhead(), then push the new headers and rebuild the mac header below them with skb_mac_header_rebuild(). That rebuild needs skb->mac_len of headroom, but dst_dev_overhead() leaves LL_RESERVED_SPACE() of the egress device, 16 bytes for plain Ethernet. Where the mac header is longer than that, as it is on ingress through a VLAN device with reorder_hdr off, the rebuild runs out of room: skb_set_mac_header(skb, -skb->mac_len) computes a negative offset, stores it unchecked in the u16 skb->mac_header, and the memmove that follows writes skb->mac_len bytes about 64 KB past skb->head. Forwarding plain ping6 traffic through such a device reproduces it on all five seg6 encapsulation modes and on the rpl and ioam6 inline paths; skb->mac_header comes back as 65534 on a 704-byte head. Return the larger of the two. The helper already returns skb->mac_len when it has no dst, so this only makes the other branch agree, and it covers every caller rather than each call site in turn. Fixes: 40475b63761a ("net: ipv6: seg6_iptunnel: mitigate 2-realloc issue") Fixes: dce525185bc9 ("net: ipv6: ioam6_iptunnel: mitigate 2-realloc issue") Fixes: 985ec6f5e623 ("net: ipv6: rpl_iptunnel: mitigate 2-realloc issue") Suggested-by: Andrea Mayer Signed-off-by: Yuya Kusakabe Reviewed-by: Justin Iurman Reviewed-by: Gabriel Goller Reviewed-by: Eric Dumazet Reviewed-by: Andrea Mayer Link: https://patch.msgid.link/20260922-seg6-maclen-headroom-v3-1-7b2f982ef79d@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- include/net/dst.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/net/dst.h b/include/net/dst.h index b3ac23e14adab..c5406f6a7f5a0 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -453,7 +453,8 @@ static inline unsigned int dst_dev_overhead(struct dst_entry *dst, struct sk_buff *skb) { if (likely(dst)) - return LL_RESERVED_SPACE(dst->dev); + return max_t(unsigned int, skb->mac_len, + LL_RESERVED_SPACE(dst->dev)); return skb->mac_len; } -- 2.53.0