Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4448957imw; Tue, 19 Jul 2022 06:51:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u8avPm0QemASKjc00cm2WL2A0hf9PX950bCsg3pOChpQo79oP9J1wpUxYUcL7MqsJ6Eu6d X-Received: by 2002:a05:6402:510c:b0:43a:e041:a371 with SMTP id m12-20020a056402510c00b0043ae041a371mr43121096edd.424.1658238716583; Tue, 19 Jul 2022 06:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238716; cv=none; d=google.com; s=arc-20160816; b=VPRl3cmdMbelO2qiz9CrKzRt5FCAkAD0ljZ0dNXH0vZ0kGtpQ2uLH439xOKbuQKndL oRgw9zNscaBWAj1CDiqj2gKqf0HvEB2C18qfJwe7oqdDR4lheWX4u+/hK0awu0FEk24d OMOB9fCFIfrYhRkW/reUMDQbucn2Oc4NGFFzvJKSTh49gk1ab3u4CYYZRK1rtdg4nqMy PMKr3NvdV0owE9PXzIH+7eNjJBsfgFNUrIOtqs1Ql3pzFblF9oAQPlGN9GM/aFD1/QKU iZN3MUw/lp4tVwn3sUn2J4iXnpmfotF1GFSimUA0VDu2LPo76Ek9iQaqJnku3Y8bo2O9 TX4Q== 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=3GRP0s7lkpAG/hY2996rA9tF3dMG7R3F1n0GKhxJ9pk=; b=hlDooiNdJewTfdg4N3SGNjHsZKK3B10LWsBSnbQzta6sKUTv9CvyQ+Er0I7v4OPafm VzKBKWak5CiMbWueTmaSwsNee7z2TObexcFm/FP4SfRijpFI5W4DnPMl3UmEBu+CIJlZ M2dEqUYoTv3CY7U/pFIMIWI6ESj0z5SuXPBgDtSIMAPLTqKmJVVT5Q5zL7bsykpor/gq 4HEWFG+EZ8U+57BjbOSnLUpJ1feTodaFvdExlfbzrIzPq9WDnci8vQAZ9/axGJMw3L13 cdtLGxMVJ0cARRFrTq9CnEIMZ7VkcQ0QotoHZW/5MmGnnWPdKgQcH7P5bLvtLxo0vNp7 hLUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=W28UIuhd; 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 j30-20020a056402239e00b0043ba52ffd16si302576eda.453.2022.07.19.06.51.30; Tue, 19 Jul 2022 06:51:56 -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=W28UIuhd; 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 S241133AbiGSMjC (ORCPT + 99 others); Tue, 19 Jul 2022 08:39:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238473AbiGSMiW (ORCPT ); Tue, 19 Jul 2022 08:38:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 376F34BD0D; Tue, 19 Jul 2022 05:14:55 -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 B948E60F10; Tue, 19 Jul 2022 12:14:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8350BC341C6; Tue, 19 Jul 2022 12:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232893; bh=+r9ifSNjvcwGWvUxyHGxx4Fuw3pp4Jg0XN08SheBXQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W28UIuhdsFIOGzD1JA1Gw89tJp5WVBsiYiewS/H+NAnyCaWPkh3j0vIWPTeP6knlM 9D0PJy2E/6dM53d4tjpNQUktOYNpLSjJ2HYv/14z9K0HRVJZ1rDAVCFMUGOltpT3nZ +X30LKNugaiKjsYrpVyt2hXDB/XS1/J/G0Q9vi1w= 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.15 103/167] seg6: bpf: fix skb checksum in bpf_push_seg6_encap() Date: Tue, 19 Jul 2022 13:53:55 +0200 Message-Id: <20220719114706.420976964@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@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 d1e2ef77ce4c..8b2bc855714b 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -5851,7 +5851,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