From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9CF03876CC; Fri, 4 Sep 2026 05:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788501140; cv=none; b=ZPmAOPVJ10+b+RlCKthYOvdxncAsjf6wk/6sYdCIaH1xLhCxkBtFniB5+9eEHpbhibOuN0zdXfj2oPDkJ9j+LlJW+4ueNxkuGfPp4f96h4tBSP/C63qrw12Q0Unv+LlJ7wGEwoCI+g9G/okHGnSinTlbkOAMdmYaF2MnKGwprAA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788501140; c=relaxed/simple; bh=DVpGkm6WUQwU11lVtbhoGRx7MEC9t4Q8gDXD2EQ7F38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rUnh3NYmofs2tTrsXyji7v1spDXnT9l5xPsplTKYtpaJM9FOaaEXVkuMSKmyZf1CA7j2mkPUYELBrEd1xbuVcaBBZtW/K3v0aMYnV2usDtI49byxQpm0jcMXn+qBOP7oIghJ5OOI8fLq31VNTw88pAGhQ0yO9A5Cb+PAvvNE9aY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=duz1aUYh; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="duz1aUYh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 507F01F00A3D; Fri, 4 Sep 2026 05:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788501138; bh=pdLoUuaynqpybIE6RmwgOnZc1vNglQV+y2MdzmbYX0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=duz1aUYh/BSO4ze1q4GNt4FDiN1CDin7KdhC3QInB6JsbTAVhauezU46XpeQYJiZU 7Pz4qJhDKMVBXy2cmiypk8/cidAFelbjRi1AtK3aWOWdO79cj61s5TLB1hHp/eCsd3 qc4ufvpISmNHqDmnYR6MGQybegWJA0CA0aQgS+mo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ido Schimmel , Zhiling Zou , Paolo Abeni Subject: [PATCH 6.18 261/552] ip6_gre: fix hardware header length for NBMA tunnels Date: Fri, 4 Sep 2026 06:56:58 +0200 Message-ID: <20260904045755.764390379@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045747.813364717@linuxfoundation.org> References: <20260904045747.813364717@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhiling Zou commit 505b6d296c486ef7d1274f279d4c43a172f63224 upstream. ip6gre_tnl_link_config_route() accumulates the lower device's hardware header length into dev->hard_header_len whenever header_ops is set. This is incorrect for both users of header_ops. ip6gretap and ip6erspan have a fixed Ethernet hardware header length. For an NBMA ip6gre tunnel, ip6gre_header() creates only the GRE header, the optional FOU or GUE header, and the outer IPv6 header. The lower device header is headroom needed later, not part of the tunnel device's hardware header. Keep the lower device header in needed_headroom. Set hard_header_len to the tunnel header length only for ARPHRD_IP6GRE devices with header_ops, and leave the fixed Ethernet header length unchanged for tap and erspan devices. Fixes: 832ba596494b ("net: ip6_gre: set dev->hard_header_len when using header_ops") Cc: stable@vger.kernel.org Suggested-by: Ido Schimmel Signed-off-by: Zhiling Zou Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/64b46542bbe1701f07702aaa50273e2a87903db5.1786542637.git.zhilinz@nebusec.ai Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_gre.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -1136,13 +1136,8 @@ static void ip6gre_tnl_link_config_route return; if (rt->dst.dev) { - unsigned short dst_len = rt->dst.dev->hard_header_len + - t_hlen; - - if (t->dev->header_ops) - dev->hard_header_len = dst_len; - else - dev->needed_headroom = dst_len; + dev->needed_headroom = rt->dst.dev->hard_header_len + + t_hlen; if (set_mtu) { int mtu = rt->dst.dev->mtu - t_hlen; @@ -1170,8 +1165,8 @@ static int ip6gre_calc_hlen(struct ip6_t t_hlen = tunnel->hlen + sizeof(struct ipv6hdr); - if (tunnel->dev->header_ops) - tunnel->dev->hard_header_len = LL_MAX_HEADER + t_hlen; + if (tunnel->dev->header_ops && tunnel->dev->type == ARPHRD_IP6GRE) + tunnel->dev->hard_header_len = t_hlen; else tunnel->dev->needed_headroom = LL_MAX_HEADER + t_hlen;