Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3282746iob; Mon, 16 May 2022 18:04:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye04LwpZ4VEtmIFVM91lp0saqlz/0h6dwhxCtYp+qY60mjkgpdmbPwJ51YA6kWta8jNIeG X-Received: by 2002:a17:907:7248:b0:6f4:34e4:fc63 with SMTP id ds8-20020a170907724800b006f434e4fc63mr18084281ejc.553.1652749474270; Mon, 16 May 2022 18:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652749474; cv=none; d=google.com; s=arc-20160816; b=dgLsNnGtLJSmU1Sn0TuK4olL0nUmB3FB1wHQyMpahR+1tNZVr3/TSbHRnEIynfpZvz Bljv0ipd3ndpSaqR1Z9LHtcvXuEErY2PGiqtksqz/Yu/sHc/zOWBKD5jSS4OXuUTCyiA /Dbxl9Ugep2kBK08HtIA4RTcdMm1+EoQF+0RASd9Zvq1Uc9YKy0vfPV/fCTyKHb9Ys3H QpOGgiCdAbkxTraW61QaWQJQSrC/2GXw3wfImD+s8GQkyEuXUIQmOkFpGd83o0V3oGGv VmLfU8dFtGzdzOD2bB45N0VMg4WvR5w+MyvOHvM3Lcj3NCS4F4a0do4R3xW0F0mrZLOz 8Kqw== 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=oB16VXTkqN21c4AGvHbRNuAXkNESPuyPn7I7Z7L4IB8=; b=FmrKeUdf4WNqvW+PDEpGtsY81UFePP+PCkPr7BddcmEwTjQjnZ/yrlFw7iXc6YKsnc 0bJllYzXicJ6SA9qUzJYS8SkJybHX3KsToysGrBKrRk+IIMOrXTyoeWj5NZjf/6AYZmo nN30A7grJzEWVb2LJ43ZO9GF75him/V4T5MXMhc2aHRaoYhGFCmGGKdxB1nIlkbiC6IS i62cga9G6FkfcEjWzUqwqhqKO2T8+Gdl00lwzaAaFF1dS3wraK2t9Qf92FB4VTzMNRVn 7elkm7ZgKQNZ/HzvORXiu0GshfyKMKw9Mq1YuMtao4QMd0AxQYFGgRq0HYvZyiK5Whxd WZRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l7B897HB; 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 ne23-20020a1709077b9700b006f3b34eb9cbsi1152591ejc.301.2022.05.16.18.04.09; Mon, 16 May 2022 18:04:34 -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=l7B897HB; 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 S1347109AbiEPUUB (ORCPT + 99 others); Mon, 16 May 2022 16:20:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348902AbiEPT7C (ORCPT ); Mon, 16 May 2022 15:59:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D29B20F54; Mon, 16 May 2022 12:52:30 -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 BB2AB60A50; Mon, 16 May 2022 19:52:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCDFBC385AA; Mon, 16 May 2022 19:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652730749; bh=HDvTOfzkdRxHd6HWC3WkqsEF8BETWp49rWnYi3S1Hlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l7B897HBsXIsZgBpJhgqWaHOqF2Vm6/FkNZdqKPbvNh1UXyMDZV5o7N+EfgyTxNcl SQhgpPt35NZMxNkdYsFWiyibP6KKAc016XgnYgb8NiUczvOENofME9i5jMU6pUV10R 03jU2fDPhQPLLGA/yfhyBEHjYfbE3Msxv24JQ0Hc= 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 , Sasha Levin Subject: [PATCH 5.15 056/102] tcp: use different parts of the port_offset for index and offset Date: Mon, 16 May 2022 21:36:30 +0200 Message-Id: <20220516193625.604662759@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193623.989270214@linuxfoundation.org> References: <20220516193623.989270214@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.4 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 [ Upstream commit 9e9b70ae923baf2b5e8a0ea4fd0c8451801ac526 ] 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: Sasha Levin --- net/ipv4/inet_hashtables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 606a4220ebb9..81a33af8393d 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -777,7 +777,7 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, 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. -- 2.35.1