Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4451628imw; Tue, 19 Jul 2022 06:55:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tj8iEZy3xQysynm+b9CrrBi7rLpZH99QQ193JIKxrmvJabE/sUORyezHCSpNvEis94cPoG X-Received: by 2002:a17:907:60d1:b0:72f:42a0:f3f9 with SMTP id hv17-20020a17090760d100b0072f42a0f3f9mr6970882ejc.727.1658238920492; Tue, 19 Jul 2022 06:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238920; cv=none; d=google.com; s=arc-20160816; b=lNpzWIPh0iwXZZt5TvRUEOgz5MUDUWZzg6G8BlleM4Ll0XJylHCgVkca1KebtyNzAl VG7CKVnEwO2sOec5U1MFJiuQnYwdOU/+FdxqQW8o8mKNSMzfEmkb8vWUXmE4aYnFUiuY 2+qI9ERox7jvxultUYFQJT5IpHM4uV5W3fn2kMIi2Je9mzHRNqSv35+D4oX7gc1pv0mR qa4ILXOG1beDSwaL/eTsx8cCBdcqZgrUNArqZpF9Ux2FxspmnD+0RNhZonm8allSB9lZ Yf/p3fFi27jaV6kXJHx93gEbc7ogPpHsCzOlb4240JY+r3ByBVSpH/lC1tnnRLCo6UWH b7yQ== 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=nDpd3D8JpNC/COmeTNTlm9MbKkCnQAHH6+w7e94+sFs=; b=M3FbFI/c1qYegZGn/Uao+KQfqquQYDFOVkTCICnxJEVP5evjH/6ooTLnsmT8O+UrVR EGNJDlubZyEpDYmjuMN4IbvTTIiu1ZqShiDkEFzH3pX7K8w9TC0aeBi3jOYiCXrp4fP4 xkzVmTGnhLaW8wHmUWk91NI9z+SFpGf0XD1Q8YTZrnnjohmr4JsVegIvxJRi6T1ZtRQV Peq3g4QJLLHlGg0y6/oWIFQs/Yo4MPpDVEgmUge0CBBPu1+/xvzTinL/wYA80YXrbhKj 3oDMqX4lAsGoGFQe2tvJUdQBCKefzTnQxC2vK23LfZfFLPTpNbk4Nd5LYX2dT1oNxosX zqCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FPNfHZtj; 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 f12-20020a0564021e8c00b0043795656e7dsi21658832edf.463.2022.07.19.06.54.55; Tue, 19 Jul 2022 06:55:20 -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=FPNfHZtj; 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 S242733AbiGSNBs (ORCPT + 99 others); Tue, 19 Jul 2022 09:01:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242711AbiGSM72 (ORCPT ); Tue, 19 Jul 2022 08:59:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D513422CD; Tue, 19 Jul 2022 05:24:51 -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 sin.source.kernel.org (Postfix) with ESMTPS id D0D74CE1BCF; Tue, 19 Jul 2022 12:24:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60514C385A2; Tue, 19 Jul 2022 12:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233487; bh=PqrAsJ/FF2MY6nMGvixd5t6bmjHkSyaeV6AQ2pKUo2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FPNfHZtjv3yHTs1Ya8yv/X/vtLOm9JgB3n9acKjfrBRhcAXiIHaGsQCXw4XZySiz0 dRPRL25VcCANbnewOANs2XxQRKfUpsanr0vPrQ+qn/WAPfc2p6FC7msVDySSQULtZn lCOuQMIMyT2WP8m1OLry5cyIfmbILx6dDP5LB8vI= 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.18 138/231] seg6: bpf: fix skb checksum in bpf_push_seg6_encap() Date: Tue, 19 Jul 2022 13:53:43 +0200 Message-Id: <20220719114726.014296437@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@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 af1e77f2f24a..6391c1885bca 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -6148,7 +6148,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