Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp868510rdb; Sat, 7 Oct 2023 02:28:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIKK2Td7JBITc+jyuEBnpJ8oO5tOG/B3YsqUIqQ8cYPuiVcILU1NDFY964x2voW2eAqqTT X-Received: by 2002:a05:6a20:7da8:b0:16b:bd0f:ad06 with SMTP id v40-20020a056a207da800b0016bbd0fad06mr4825313pzj.31.1696670939509; Sat, 07 Oct 2023 02:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696670939; cv=none; d=google.com; s=arc-20160816; b=TIqgXGOa6n86mheEszrJGKgdUlmbFYDJ0EH7pXWkggMxM/iUDv6J9Rg6G4dLTHiJbX xezXM39C3V17yRipd+WFhWaWAxqWxo3GjaZ7ko60BYlfIIBWg/V9W1RaLm1mW7vHD03V d1wDpGZ64iyFIyeVEeMyGKEiZhfVV+j2JN+8ujjo9ZgKVev4EUvjLJGBwI6LZkocFHqP /pEnjUuxz9Ktchb9UEr7jwbxMiBCoZT793vhwR2x48Vjuo12J2kXAQg653e967swe7tF pf6ELQQ9+SDdxmBHm+I8QcZxaEREBp9Qa5AKUwBWXWJFRgMyYqQ650e6T2Sy11vbYTSP zYJQ== 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 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id t12-20020a6549cc000000b0055b43079642si5391574pgs.120.2023.10.07.02.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 02:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; 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 2620:137:e000::3:1 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 8826080BB6F8; Sat, 7 Oct 2023 02:28:57 -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 S1343730AbjJGJ2e (ORCPT + 99 others); Sat, 7 Oct 2023 05:28:34 -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 Content-Transfer-Encoding: 8bit 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:28:57 -0700 (PDT) X-Spam-Level: ** 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, -- 2.34.1