Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4368988imw; Tue, 19 Jul 2022 05:29:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ubUefB0Mz1Ipa5Kq9Yx489GFixhs5qg270f+4RU4rENk52uOFQRclECb8XY6fjEcLDcP6q X-Received: by 2002:a05:6a00:3392:b0:52b:4896:b317 with SMTP id cm18-20020a056a00339200b0052b4896b317mr19756418pfb.17.1658233759635; Tue, 19 Jul 2022 05:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658233759; cv=none; d=google.com; s=arc-20160816; b=w5CIETdTsmFpmAiP5afX42z4ZLpJocisN1c+BB7sXw0MmMXSUE4OgEAVDdXf7SLowu Eui3M2kIaFpqZLlJjhvdiWIj7jTKWb24gI4uZx6BB/dqeQDSGsJy+e5Zh9o+rhjR1vcD TA9VnZgIJvE+wnzIJdIYoN3ra6MEKKt+KWpXzrvjtV3w+QOpcpEpBX41mUGfXhub95II HjlqCDyG/h7k5Of9hX4cbU/ujvQKm14nOm2ae9Z8u3LgHZyVLhboLIAYvBVqmJ0SmZSN Bt19CDejN2++C5hGIbqwVh7QFz1UkmHsGdmz5xKENWchuXOylkAL0H7xJx7xF+ozfkdL 3Klg== 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=tz+IB0qtpRJ6xZjwEOq/rjmpc8eV+LfOyEnC2sbYPTQ=; b=zagD2J9WrC+jGUOrkN9OBeEtM8xddlKOW8NHI3KgXdwt3a5gH7AzxjPhSMA8+7FKRf vxrM/S2xJYn6AlpYEaREtTPuUnrDHAW73XSb1yQvbx6SS1TYOOKI1u70pVHT90Z1wWP3 0821IGl73ioXRJu9FgDerWGODJHG3BQKrxUt+0Rw0oizyB31cksH8SXBep8QN5U6bUVs MFzl97DbQlenITbFIDxpNBOZraFckKp0y4ou8YgHJ62uZa88LubpYWxf71LRSj0uyazx QVSYzW1jWZuLmuEkJSKKZnQVIEU9j/3MQqAMG4vJL4aYw7QLxFimNCoe+dc9+uxPQ80h PyQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NjiIkXPu; 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 t2-20020a62d142000000b0052ac145e8ebsi16743165pfl.83.2022.07.19.05.29.04; Tue, 19 Jul 2022 05:29:19 -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=NjiIkXPu; 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 S238125AbiGSMF3 (ORCPT + 99 others); Tue, 19 Jul 2022 08:05:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238162AbiGSMEH (ORCPT ); Tue, 19 Jul 2022 08:04:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6E3C4BD3E; Tue, 19 Jul 2022 04:59:56 -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 687AA61614; Tue, 19 Jul 2022 11:59:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4405CC341C6; Tue, 19 Jul 2022 11:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231995; bh=xL1HltxFhI1tLbk5EtyBpYCOs7A1TDc2DLehvGPeY/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NjiIkXPulWdCL/jaKM+MmPkYWXDFdbroM739uqHtbaV0jF3ns+hL5xHMJPV/poy7c ha2+rkhR1HWcGQoaPsj5IvC/NWiA0oEO/K7tvqo7iZJzwhfzGrWcKF+DPvW2odICqe tkHlwjuRjBE8ecu9yOc7hzuJw1rOWr+PgZJ7fMf0= 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 4.19 25/48] seg6: bpf: fix skb checksum in bpf_push_seg6_encap() Date: Tue, 19 Jul 2022 13:54:02 +0200 Message-Id: <20220719114522.156902900@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114518.915546280@linuxfoundation.org> References: <20220719114518.915546280@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 c1310c9d1b90..5129e89f52bb 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4570,7 +4570,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