From patchwork Sat Oct 7 09:23:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Guo X-Patchwork-Id: 149544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp830747vqo; Sat, 7 Oct 2023 02:29:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEd2fZlM5KkVUxl3EiEPOvSFSZzuqS0aPln7tvQ1IQmsPg4ysydmLF2PN/ubOpa11IXzVM8 X-Received: by 2002:a05:6e02:106b:b0:34d:ee65:a8ce with SMTP id q11-20020a056e02106b00b0034dee65a8cemr9288586ilj.19.1696670947961; Sat, 07 Oct 2023 02:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696670947; cv=none; d=google.com; s=arc-20160816; b=OVHR0JB2D3EJM0MViyUc+wKhPuTkbFqZkzxVqDhAQFNlYx3rBjBhT27iOClUtvtYl5 AsCsJ2IaABBUOqdzNm5Og7sytkDpR0WsTkvRd0Uu+0Fnm/4YwrvVrqBlMvCOzZeSCV0h bj53HGwU9fbaCe8a/jFsD5hT6YsD/9JESe45X2kdN1gM6WCMZoK/EzBXm7wr1z3ItF1l l258JsgWrbaG1mSK28HumLmtE2ksJ/63TZr3E0kGGjfmhPHtyx/Q7CsocVROXhqwBdxi k7bodeTHK+rK9omRma8Ug5I6wX5hxoVqRy/LYnz5uWjrqiiwHjQzWj22W8oT13O2wdHI 2clg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=S5S6Bq/7hDO06XukKZO/A8hT6aAJLIcw9FkCCFsFcrU=; fh=KMzgJSJ1NbgxkIOerVzBc4RkHk1hNawibDYWy0cTmHM=; b=X0enfVl6ehTUWFsavF+nAqbDnk/SoP57rtyZwryYkG278G+k0+05DAik/G3VXErCJF i0Erh5foL30GWyj37YkqQWrxqlcVMezpzcrEFrkhhE7QSNoCyiT9Zhmt2QMhHt62aCyM xotai2hVJIQpmiFplAer7bULQfercD9S06c4xojo0T4UPsBGQdrg1rOa3cL1+vSRQPVc k3TUqc4GdV+7MErInhwZMhsZA5UABun0A8j/qs+29pWjcNcs+YfHY/5Ws7aEaLM75SJJ r8FAKx6ogHFUV/Xqddo3QUi7Ts0vaJiOMwvjh+rPD3AnpqU2G/9RLqaCmhYI9QB2QPpB +heQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=OfKuyt06; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id e124-20020a636982000000b00565e5916ab6si5266774pgc.598.2023.10.07.02.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 02:29:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=OfKuyt06; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id CDC1B80BB6FC; Sat, 7 Oct 2023 02:29:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343696AbjJGJ2f (ORCPT + 18 others); Sat, 7 Oct 2023 05:28:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229757AbjJGJ2e (ORCPT ); Sat, 7 Oct 2023 05:28:34 -0400 X-Greylist: delayed 376 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 07 Oct 2023 02:28:32 PDT Received: from out-196.mta0.migadu.com (out-196.mta0.migadu.com [IPv6:2001:41d0:1004:224b::c4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96C56BC for ; Sat, 7 Oct 2023 02:28:32 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1696670531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=S5S6Bq/7hDO06XukKZO/A8hT6aAJLIcw9FkCCFsFcrU=; b=OfKuyt06uvla2JwmSaRP6rudbR3SVvhlLJS3/RFt0oaL6UFITpEI7c7wxH1VGk48Jug7PV ZRRM7b1W9+PJHRo2D5CJSKYEBGklbiR4pM05SxfFbYcN6IbzL48q+qW9671+bMC83p7KyU 8cR2jNKbHq8RnPM8N7CpJ4i2gTLAwdw= From: George Guo To: edumazet@google.com, davem@davemloft.net, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, George Guo Subject: [PATCH] tcp: fix secure_{tcp, tcpv6}_ts_off call parameter order mistake Date: Sat, 7 Oct 2023 17:23:37 +0800 Message-Id: <20231007092337.1540036-1-dongtai.guo@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sat, 07 Oct 2023 02:29:05 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779088436285772703 X-GMAIL-MSGID: 1779088436285772703 From: George Guo Fix secure_tcp_ts_off and secure_tcpv6_ts_off call parameter order mistake Signed-off-by: George Guo --- net/ipv4/syncookies.c | 4 ++-- net/ipv4/tcp_ipv4.c | 2 +- net/ipv6/syncookies.c | 4 ++-- net/ipv6/tcp_ipv6.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index dc478a0574cb..537f368a0b66 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c @@ -360,8 +360,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) if (tcp_opt.saw_tstamp && tcp_opt.rcv_tsecr) { tsoff = secure_tcp_ts_off(sock_net(sk), - ip_hdr(skb)->daddr, - ip_hdr(skb)->saddr); + ip_hdr(skb)->saddr, + ip_hdr(skb)->daddr); tcp_opt.rcv_tsecr -= tsoff; } diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 27140e5cdc06..3d6c9b286b5a 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -104,7 +104,7 @@ static u32 tcp_v4_init_seq(const struct sk_buff *skb) static u32 tcp_v4_init_ts_off(const struct net *net, const struct sk_buff *skb) { - return secure_tcp_ts_off(net, ip_hdr(skb)->daddr, ip_hdr(skb)->saddr); + return secure_tcp_ts_off(net, ip_hdr(skb)->saddr, ip_hdr(skb)->daddr); } int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index 5014aa663452..9af484a4d518 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c @@ -162,8 +162,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) if (tcp_opt.saw_tstamp && tcp_opt.rcv_tsecr) { tsoff = secure_tcpv6_ts_off(sock_net(sk), - ipv6_hdr(skb)->daddr.s6_addr32, - ipv6_hdr(skb)->saddr.s6_addr32); + ipv6_hdr(skb)->saddr.s6_addr32, + ipv6_hdr(skb)->daddr.s6_addr32); tcp_opt.rcv_tsecr -= tsoff; } diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 3a88545a265d..ce9cc4c43cf2 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -119,8 +119,8 @@ static u32 tcp_v6_init_seq(const struct sk_buff *skb) static u32 tcp_v6_init_ts_off(const struct net *net, const struct sk_buff *skb) { - return secure_tcpv6_ts_off(net, ipv6_hdr(skb)->daddr.s6_addr32, - ipv6_hdr(skb)->saddr.s6_addr32); + return secure_tcpv6_ts_off(net, ipv6_hdr(skb)->saddr.s6_addr32, + ipv6_hdr(skb)->daddr.s6_addr32); } static int tcp_v6_pre_connect(struct sock *sk, struct sockaddr *uaddr,