Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2162028ioo; Mon, 23 May 2022 11:33:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPunvZPa4zUVlcbqo1OalkULWlQXcehpaqxR+W2MM2uphxvj2+onj2eZWrgQauUnqdobXz X-Received: by 2002:aa7:888a:0:b0:518:a0b8:f5c1 with SMTP id z10-20020aa7888a000000b00518a0b8f5c1mr6119476pfe.46.1653330821653; Mon, 23 May 2022 11:33:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653330821; cv=none; d=google.com; s=arc-20160816; b=hZRP8zt5aYm4cPfGgp9wP669FTygfW7cUmZxIw6AzJ1/xPCrV7tYlqJowFLXePmsZ2 mQK1geqKsuFXwKENB8leXPnjzZ4q1DfhGCypM3FPAUgyvKG0KGX9kVGYDot9YRoV6Bg/ IVku29Dr+BerWDZhuy1ArJAvOZPYeHYZO+qbaqMM4lxBwpEUJstC5PMdxRNhrfQVEah0 p7BO9/nKFTbnU3CcTk4/ddQHvxfVjwwhpPAzsLLqOg74TYhCw4/0N5sRRbpH0Qhw9/eC 9pg1eOz1hgdpaibwKa3X2MuokIl4NG/r2ab2XLJQU2VZXyqn3rwWbnG6ckV64GsdClBU f2sg== 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=zKV+MyLuX6sqDQhKsDG0gY67KEsud8oQAyoFx/PfpE0=; b=usBtpWwU8IT4eOyhqriWayDnN+aHyTAdlJ6cRWdG8SS5XwYDaPpXlj6Ce5FfyVRgnl uB1WSIJHTSrqsxbDyX/uetuoKEb4X5OsA1bBt/JxIg9ZWXvLMMPb0jkExGE4qRXeW6Ty vCwiNsSbXz0qgFoHuApIRO8ZkUtb77Pc60iIoAHMtYsuXvyL+en1jqCN8Y2yBKqm5TFv f2LoWMr4SGWuwqn5fcyTey79gIAXVhqwbqvPqx2MpqUF0ixjkLPTjHr/of7PJcV2wTi3 CnoUcpcPUl/ILmSN+5jsyfzCB297UbaNdFJqh6kGt3DJ+GhA7zn34PiPDZvwILyTNu9X G2cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jr7xFsRG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i70-20020a638749000000b003daf6356570si10156329pge.3.2022.05.23.11.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:33:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jr7xFsRG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9FB18149D82; Mon, 23 May 2022 11:32:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243442AbiEWRiO (ORCPT + 99 others); Mon, 23 May 2022 13:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241696AbiEWR1F (ORCPT ); Mon, 23 May 2022 13:27:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF75373574; Mon, 23 May 2022 10:22:08 -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 ams.source.kernel.org (Postfix) with ESMTPS id 51057B81210; Mon, 23 May 2022 17:21:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F6ECC385A9; Mon, 23 May 2022 17:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653326488; bh=2QNI6p3DCQnj328K6ybIE7IWGu/SDS5fAgkPESIDXyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jr7xFsRGkFizGD41waYYOZlNvMot2hr3YyV3BaRHoCXR/lotoe1YfLO5WEFEKzdbC p4CDLNLEoGuiDjd70hz0tW0It1pBVjPwN5edrqHxzuVF3KufF5heazlWWOg9Lh9eL6 zG2OjNoJVeRJ/bjII3uOQIfpMd6+GJ3g0dnXXIhs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geliang Tang , Mat Martineau , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 096/132] mptcp: reuse __mptcp_make_csum in validate_data_csum Date: Mon, 23 May 2022 19:05:05 +0200 Message-Id: <20220523165839.281588719@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165823.492309987@linuxfoundation.org> References: <20220523165823.492309987@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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Geliang Tang [ Upstream commit 8401e87f5a36d370cbf1e9d4ba602a553ce9324a ] This patch reused __mptcp_make_csum() in validate_data_csum() instead of open-coding. Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/mptcp/subflow.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 6172f380dfb7..04afead7316f 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -845,9 +845,8 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff * bool csum_reqd) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - struct csum_pseudo_header header; u32 offset, seq, delta; - __wsum csum; + u16 csum; int len; if (!csum_reqd) @@ -908,13 +907,11 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff * * while the pseudo header requires the original DSS data len, * including that */ - header.data_seq = cpu_to_be64(subflow->map_seq); - header.subflow_seq = htonl(subflow->map_subflow_seq); - header.data_len = htons(subflow->map_data_len + subflow->map_data_fin); - header.csum = 0; - - csum = csum_partial(&header, sizeof(header), subflow->map_data_csum); - if (unlikely(csum_fold(csum))) { + csum = __mptcp_make_csum(subflow->map_seq, + subflow->map_subflow_seq, + subflow->map_data_len + subflow->map_data_fin, + subflow->map_data_csum); + if (unlikely(csum)) { MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR); subflow->send_mp_fail = 1; MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX); -- 2.35.1