Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4372700imw; Tue, 19 Jul 2022 05:33:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tVdytzmxhJD1YmyDXVKBx/tCvabQOpTGaGGORmS0KZxFCTBD6ZA6OtC5nIssh+3NljraVL X-Received: by 2002:a17:907:2c44:b0:72b:6160:c64c with SMTP id hf4-20020a1709072c4400b0072b6160c64cmr30534134ejc.55.1658234005013; Tue, 19 Jul 2022 05:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658234005; cv=none; d=google.com; s=arc-20160816; b=nV0ko+3VTG4EKBupCcFay8chgn8rtiFTLTy35aG9AdWDLxYyL9xhelwwR6IVTQmWW8 ORsAtQkxnA0+8DczEKTnbXI8vxSFdi3n/6KRroijrjgLbPPzRbQyv/bmUuHZpwun35YC X9WGBMbF9ckhi7b/Cx+2Ne+ZuuwNmimusYDNexoxOjyBKe5sfDVZ1T9eQcmC4cTPAq+x cN53sJmVrT2oHGocbofce8bYrBXzNla/613Q5gcZyc3XJmgDE6iXf7ezQ69VGq/i6rGb w+IjGUx0XGxVAZJDuHfdTiPJZ/uzn5Zq57CX2cLBkJOj2abTZOIqEQ0VHHV/fB+xKbeM 28NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y4JhNHOqpjNVJRq3QcXMKcsVFRrvR7cQLU+y9aV/tlo=; b=MCfrnTqT+dYvsdI8NhfZQnr8imd8fmVlPGb7amALZBdwOJtnZeH9RRVia1O9YJXuiM CY1Vd7PRdIu2O028YLl9tqkBCJNR1MXIlarSlzxBq04ebPlQZZaUB8mrASjy34YZ3KOL NdyYobEhjNuFBNlTnbyVXBGVWlU7uI6wuZs207FSPoSl1LGQeAGZSU/WqLVqnVkoG325 09bo5N4F8OiaoJh/G43gVdR9cb3+ehuOkMCpqPLgaWVh3nrljk2VKxGo8DPmVaX+W37v Rl+u3haNEYRviWN8QhFHf2N3We55uz7PGa4ssNH9berZygr7aHfTB5MqFCLTlYPR6BZi 04Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VSPHneYl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a170906138b00b0072a7935544dsi16469336ejc.325.2022.07.19.05.33.00; Tue, 19 Jul 2022 05:33:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VSPHneYl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239480AbiGSMWS (ORCPT + 99 others); Tue, 19 Jul 2022 08:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237158AbiGSMV7 (ORCPT ); Tue, 19 Jul 2022 08:21:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0691C5B060; Tue, 19 Jul 2022 05:07:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B3DB6177E; Tue, 19 Jul 2022 12:07:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19E98C341C6; Tue, 19 Jul 2022 12:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232473; bh=cNhI+a8I7IO+06jv19zsRcQ2ZXeOYbVOu5fi1vXCaI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VSPHneYlXcVSlP4YQO6p+MWWvZ0XPv6lNzwDw1KgFY7Y66Q1zOMG08NLRsI1rj57Z 9XigEZYO4WMRW/L6DWhBRfe3DqfbNZE5Y1j9Qhhqe4a8igO/gO30U/OYz8RD35mC82 jHO01xMdUOJOcbCoRT/qc2cVJchb8TQEXRehLM3Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrea Mayer , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 070/112] seg6: bpf: fix skb checksum in bpf_push_seg6_encap() Date: Tue, 19 Jul 2022 13:54:03 +0200 Message-Id: <20220719114633.262209406@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrea Mayer [ Upstream commit 4889fbd98deaf243c3baadc54e296d71c6af1eb0 ] Both helper functions bpf_lwt_seg6_action() and bpf_lwt_push_encap() use the bpf_push_seg6_encap() to encapsulate the packet in an IPv6 with Segment Routing Header (SRH) or insert an SRH between the IPv6 header and the payload. To achieve this result, such helper functions rely on bpf_push_seg6_encap() which, in turn, leverages seg6_do_srh_{encap,inline}() to perform the required operation (i.e. encap/inline). This patch removes the initialization of the IPv6 header payload length from bpf_push_seg6_encap(), as it is now handled properly by seg6_do_srh_{encap,inline}() to prevent corruption of the skb checksum. Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers") Signed-off-by: Andrea Mayer Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/core/filter.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index 246947fbc958..34ae30503ac4 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -5624,7 +5624,6 @@ static int bpf_push_seg6_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len if (err) return err; - ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); return seg6_lookup_nexthop(skb, NULL, 0); -- 2.35.1