From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.200 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796374570; b=e67ljGat/x5yZTe/2QJicvm+QMZ8J82mVEGuIEkhkZeZHCUMzI0/zx/KDIY4oiir2eJJ mpLLmEJpsPMO87ux7lBdviOZOKAqHr2EJvT7tQXtdckE3QTPe8It1tnIqyCfl+iSQGJE1 6hfrvKHKqi9C0qYMTrgABJ3b8cVJAa/JdifIbipOirRj4QP+GzgqDAkSHaPPtiBhhk2xr Bo6QLM1uKM7bitTBhkzNYcTZo1yl7kacFQUpWhNoHhfTOaqBV5gDcRjqmtAABc0GKNXsz dYh+Zw9op7eIPooVrLVMPlFLTVliPfJwrZ0frqp2Vpj7B3UCU4ieRkKnymQEhT8IK3g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796374570; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=7V5ZwVkiJmFZu6t+wXicjXTYgWW3GziiNFze0M9Jt3c=; b=c3L/5uqm1g+R/aYN6sCsU9sZYOoKaTBktikwyfNTOrtWaedmSnnuZLhFaHAn9qMR2acF eYwDjONxOYLy9FnRikyqdqZHEcIPJuS5WJc0B/FX/2LYckX8zMlcolc/mle90dSZ/6jG2 rlTeMptsdcuCtes5Rr6FeI4C3+OyW7aEgN02JsYi5FxoS3KS6sh8v5X58KDLaBmo1HooC urvKUJEZve9sWeEicMRgMVMLWjt1b8nXn4uEEn45n243zY8XL61WZQjVr98xzMcNqdCZ7 dx5gETmxam884Go+kVEVoeWoyHIavRT/ivAb3tEXkrRUzQIGM91shXEZxMfxdtLcmRg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=Tl+1zACs; arc=none smtp.remote-ip=209.85.214.200 Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6907606A337 for ; Fri, 4 Dec 2026 08:56:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D6907606A337 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=Tl+1zACs Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2f03a137f6aso7844615ad.3 for ; Fri, 04 Dec 2026 00:56:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796374569; x=1796979369; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=7V5ZwVkiJmFZu6t+wXicjXTYgWW3GziiNFze0M9Jt3c=; b=Tl+1zACs0C0FhCi9tyARg2qDSVu34mzbA4pTU4RN2JwM7TZALsh8o2IyqlFW5K5F/y avsgCrWFA9kgoRy+99lCaRs9vGlFOFKxkXLqhL/SvMmd37q9qcNHqKj9s+8vpdzyDarM xuu4D9YN2BDy/EEIR8CFPY3Hv1PeKhGX5zUYjFNHoyF+KSRDtzM/f0lpXV1kf153owEE NfYYsHjkwNHLp2PKvQvMIUIC1olgTcRd87fplpyyovx0qXMWeDmCCzB39LlrV5dM/CuI oTbDs75ca26txSIr9vG22eU5r/HbYJbFCjkUsSHtJ5C4NFPIfd4aFdTapgeSr+pB9SZf MZoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796374569; x=1796979369; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=7V5ZwVkiJmFZu6t+wXicjXTYgWW3GziiNFze0M9Jt3c=; b=BPOQ1wDJnJ349ECgT6EKecsXYmUD221Uc1CLBChN3eRlaN6cGc8uRRSCohxElVAP2Z 81pKtm6YyAnv47aiBwCjB3P92WfdPqsOzXwJyq1Chq3h0BbxnBOq6Jt+u9Bsam83aIHt riBKNNDlMJ+CnzIIqGFj6o8En3iwNG1QVPPTCAw69n3ad9egF45WrxzoD+r2C/2bxvvs AqatW5L5MFJbXQOHCuFamQqKf9dh7WxXxzEdYiu/8gIs0QCWtULPkZzbfo7pdzHSkfFQ ipKKlLo4InyPRJb+1ipe5ou1kMcHCO2T5pdL6kvxwoof25DF+IFbniYdYCh7vtwMAYSV zF/g== X-Forwarded-Encrypted: i=1; AL+hErF7pbyfMhPkGa6rBNWaTKLIMhTnmCpaEJM9ilt/J7rp3hupyhFNiz/N9Vak2a1pzjQVbP6eegE=@vger.kernel.org X-Gm-Message-State: APuU4Z9qRWTerUhxr+DtN73DbTz4Uf0iSLr7Z7Mq9DYfINiW/rZmjKf7 B4bp9zHmvVJsXfm8Pz+yzSI80UcVnvC2vyThXVbCtJRQfvqzOjL6olaum0dWsjwvxsaqEHtUW2w xyS0JfQ== X-Received: from plbmt13.prod.google.com ([2002:a17:903:b0d:b0:2f0:42b6:eba1]) (user=kuniyu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:124c:b0:2e6:136e:f264 with SMTP id d9443c01a7336-2f1ba1d0f57mr13960675ad.50.1796374568948; Fri, 04 Dec 2026 00:56:08 -0800 (PST) Date: Fri, 4 Dec 2026 17:54:32 +0900 In-Reply-To: <20261204085551.1518105-1-kuniyu@google.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261204085551.1518105-1-kuniyu@google.com> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog Message-ID: <20261204085551.1518105-3-kuniyu@google.com> Subject: [PATCH v1 net-next 02/10] tcp: Don't call get_random_u32_below(0) in tcp_plb_update_state_upon_rto(). From: Kuniyuki Iwashima To: Eric Dumazet , Neal Cardwell , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Willem de Bruijn Cc: Simon Horman , Yuchung Cheng , Kuniyuki Iwashima , Kuniyuki Iwashima , netdev@vger.kernel.org, "Jason A. Donenfeld" Content-Type: text/plain; charset="UTF-8" Even when net.ipv4.tcp_plb_suspend_rto_sec is set to 0, tcp_plb_update_state_upon_rto() calls get_random_u32_below(). Since the cited commit, when get_random_u32_below() is called with 0, it falls back to get_random_u32(), which results in [0, UINT_MAX]. Then, plb->pause_until is set to a random value, which is normally cleared in tcp_plb_check_rehash() while tcp_plb_suspend_rto_sec stays 0, but can pause PLB unintentionally if the sysctl is raised later. Let's not set pause_until when tcp_plb_suspend_rto_sec is 0. Fixes: 7f576b2593a9 ("random: add helpers for random numbers with given floor or range") Signed-off-by: Kuniyuki Iwashima --- Cc: "Jason A. Donenfeld" --- net/ipv4/tcp_plb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_plb.c b/net/ipv4/tcp_plb.c index 0cc14cf41f8a..d101a424c444 100644 --- a/net/ipv4/tcp_plb.c +++ b/net/ipv4/tcp_plb.c @@ -100,8 +100,10 @@ void tcp_plb_update_state_upon_rto(struct sock *sk, struct tcp_plb_state *plb) return; pause = READ_ONCE(net->ipv4.sysctl_tcp_plb_suspend_rto_sec) * HZ; - pause += get_random_u32_below(pause); - plb->pause_until = tcp_jiffies32 + pause; + if (pause) { + pause += get_random_u32_below(pause); + plb->pause_until = tcp_jiffies32 + pause; + } /* Reset PLB state upon RTO, since an RTO causes a sk_rethink_txhash() call * that may switch this connection to a path with completely different -- 2.56.1.915.g69d5ec7298-goog