Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6135374iog; Thu, 23 Jun 2022 12:05:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uK0FklDxV6ckEea0276he8GTT9AxMOcGvTbxtkGoRupOTPQGqrzLLKLvLZshAwTMR4vthX X-Received: by 2002:a05:6402:154a:b0:435:5261:f776 with SMTP id p10-20020a056402154a00b004355261f776mr12526937edx.118.1656011117537; Thu, 23 Jun 2022 12:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011117; cv=none; d=google.com; s=arc-20160816; b=hCzhYQt5vuzkWbUjSbbxZOxpGiRJDNfOKiaVi+jXLfZ8tgWf6dNMZCt0K1SazCgFyw yknXzeV5ZOZsMI+rSva4DVLuS5mBBseA0ei/k0NyOJa0EbhOOVzJzpQI4Yklm32sMoWO qQQ5ALZwIi9rnoA3eNm0CPkUFF33kaQS3xlvYTBi5DPGJgn/zXsbOxXrsyRn0rwQWeFR iXIAeQAMxsHgNGlVZnUVxoi7TSwVj4Fy/CQR/WzmIHks6BKcCV6eL61u10G5lqGKbSsA 1Cp2s1vrlnL88/0H5eHMLhUSfvIResvWFfPBtBvnldV1joGs54r0R6Yft5J/krxk+FBk jVgQ== 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=FRPIkgLgB72EVRUdoR/sMnGEoE2/f9IZByIwBiNh+FY=; b=BHI17FBIqKQgwr5aFMiuNMkhmXI84B35cQ8Tflzo5+Dm4+8pgDJ7Y/VBV2q1w2TG0A eh82Lmz0AIneBS6M1rt+om6bVPMyt5BUbcMZQh7Tgjv/bKgAKUwcWhx9aTfcori12FTR rEqh+gch/jZiNJxbnP2j9HuhcuA0qfSp8t6SDNQm4Cldx9dAnNqRXl1rI+EjX1iMbmTj /4hgfxcKWW79/rK6uzfj1TPdTco3Dz+gOcYWKSq+SbVAxMhbty5P6fdawZNwQT5wnvW3 svFbgHbqjkgvkN3jkKp8qoimKzPLnVB942BKs+JQhj65ZTrwR2WA2Jvv+2gLSFkeBvS0 Q/ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WH+QeuQX; 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 eb9-20020a0564020d0900b00435bbe82254si495708edb.143.2022.06.23.12.04.52; Thu, 23 Jun 2022 12:05:17 -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=WH+QeuQX; 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 S237063AbiFWSUu (ORCPT + 99 others); Thu, 23 Jun 2022 14:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236926AbiFWSRa (ORCPT ); Thu, 23 Jun 2022 14:17:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE2E6479B; Thu, 23 Jun 2022 10:23:50 -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 3AEA261EE1; Thu, 23 Jun 2022 17:23:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5325C36AF7; Thu, 23 Jun 2022 17:23:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005029; bh=dL0mQC2nyzs3CkVKj/p1h7OgD5j/ax7JcZPo1cURI8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WH+QeuQXNQ8ZxRRDhQ+2niH21t4Ez8+mGUsEX1pEvK9Qfzg2WUeDfhMZ+bDMyBGTE 7u/wlq5h0EaLmGzMH2642NPX2dwewAuHJPlOYpDUMC1y8me5OVbBqoOgEImJ3bNa42 ivmeFBKSJKQmiErTLyg/Cl3dKI8No/SjhX42yOZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Moshe Kol , Yossi Gilad , Amit Klein , Eric Dumazet , Willy Tarreau , Jakub Kicinski , Ben Hutchings Subject: [PATCH 4.19 229/234] tcp: use different parts of the port_offset for index and offset Date: Thu, 23 Jun 2022 18:44:56 +0200 Message-Id: <20220623164349.529541203@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164343.042598055@linuxfoundation.org> References: <20220623164343.042598055@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.7 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,T_SCC_BODY_TEXT_LINE 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: Willy Tarreau commit 9e9b70ae923baf2b5e8a0ea4fd0c8451801ac526 upstream. Amit Klein suggests that we use different parts of port_offset for the table's index and the port offset so that there is no direct relation between them. Cc: Jason A. Donenfeld Cc: Moshe Kol Cc: Yossi Gilad Cc: Amit Klein Reviewed-by: Eric Dumazet Signed-off-by: Willy Tarreau Signed-off-by: Jakub Kicinski Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- net/ipv4/inet_hashtables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -766,7 +766,7 @@ int __inet_hash_connect(struct inet_time net_get_random_once(table_perturb, sizeof(table_perturb)); index = hash_32(port_offset, INET_TABLE_PERTURB_SHIFT); - offset = READ_ONCE(table_perturb[index]) + port_offset; + offset = READ_ONCE(table_perturb[index]) + (port_offset >> 32); offset %= remaining; /* In first pass we try ports of @low parity.