From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6C601DED63 for ; Fri, 24 Apr 2026 01:46:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776995212; cv=none; b=JWcQKQPc3XQZlxTBNLu/rl+rZstBqzX3Ty7Q+QxaViRj5sJ8Qump5wnhHLK66NiP8mP/cpXG6aCDEWRChvbnq2GhFWe3ugtpjYtngdrUKrSOq71FHefCXToRpVRTjuddY/umxg1RpDmBJiWqHCe2hHflUJ3Lfnq4X4nDLfoPe6U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776995212; c=relaxed/simple; bh=+pgpx09OZsBxydJlvD8vXXLxlKoOhDlXCo3WMPVuvmg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XcwjYv8H30BtFp8ohYGKFaT1cKbyCDmBb5wSYalylgo4WLVN01KHwxfscf4FE5ykIkxjWzMKXmPa1fA0W44Xggrl8XpLakO6Vrnr8kgBY3oX2JJsHwScys2BbXh+8PwUONA+FO06GtKRVZ8+6W/8HTM0AZKn/4qreaK1AToEdZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=rlQMv/js; arc=none smtp.client-ip=209.85.161.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rlQMv/js" Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-67c250805ccso2745375eaf.1 for ; Thu, 23 Apr 2026 18:46:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776995210; x=1777600010; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+8VXcjTmI6Dv2N/50VcqBrboi7Fp0CZ4DKMRegMcu50=; b=rlQMv/jsRg0qxu5r0Yimj3dyY6R7Hbcwb5v1oByWFjHO63XRuJfyqlvD5rRTnzgfDC 21n0LLOKlYzaqckVkkp9OBAbDU2eS949jlDqa5g9XnOVcB/KTd0hFAhCHlxeKvjv+B9c 3tOKo82XNn6fvJ3xpOPdb2byTHaQIDSvsNPFv5IoM+LqOBopFxB78TF778MHlgJ4ifSN LHK7GFo7830ubLcUGWDjvn5q/tqtxFfe1IYBeQZmGhG3iYVcpG6TmXicCNxUhzUt7Mgm sLKCSJfroUu+fRPegiB+TGXov1H34xvfl0ZJSiekGX+Sylrrt2HFy1mSH2uok37RyK7l /Bgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776995210; x=1777600010; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+8VXcjTmI6Dv2N/50VcqBrboi7Fp0CZ4DKMRegMcu50=; b=PCicB0UYvyu93t9kIY9vg6626EaDTon8+oXvp8wS/w6S3zWkzGHf9Fsb6ZZIvGyEFE MlFNryoJJ/7XU8RzqpwMilS5StklALYpgZcP2Mv61tQYe1xq/AyjN5S/xZiKrkRK+cKS GRWmNPhrf4eWUPPKFEuru/uF+drcoIRTk3i1N1AxMthg4UxIMOKxkrwQWAGXDUB952IE dhf7DxHM0rQuymwCR/jnIBs1yJ7vjXXvwUHMpxsDmSlI8OlPYIM95HeN40fs40K9Wtb+ 7opI6MtlWKdquX9B7vKbmRPO+AbqhZ65m4F6OxTVRF1YDEYMDH8Oy0tiUpD3mxBN99Tp 6QOw== X-Forwarded-Encrypted: i=1; AFNElJ+xmRKdAk8a2SRv6nGwWelHKkTpDm40Y5c0ybzDHmsa2u/to6660IqCpkdonsRISuTSNOjtR/G627epxKc=@vger.kernel.org X-Gm-Message-State: AOJu0YzkR3773EIXsyPSn3XWutpLGzQCHw38TQI20Iv2NdJVuDiibJTb 3FqoLeucd54VHGhb8hm1nJyWoevotzJACwTxO31hvles7kwQvn/UqL96 X-Gm-Gg: AeBDies1QPpi+glL/QC2AEj7WQIlrWkLWJXZQ458KeobyMMXtnhjno57QaHutD0DYlp 1dlUHYSh0KqWu67yoCqYpwaRvI6PRbEtWMfTuaiuf+p/XbEAQVXMTN5EZoBi09TnZRyHxzowg1Z 4nvyFpVdh/9R8o3XpeD2atJijQg4MEL8YoZjQgoUJOAcc4/fW2EzG6xK/458+WUZOMuhX2QK1xh exNbBNVvfcigZVT2VpoACrm4bI3OUu1Xm4UMIofO2NV02NcPhLRNsVOVCUYX4oIpaMGytnVkSY7 lInYbVSCpF6USc0GsQ/rKPOC4YldBK1zBVZT4x1nCaGYaRtB1BqhVPcOSyUgytp891S9K/wA0hR HwGx50DfbGeYAazD21CojBy7QGWjwUwZcB/tz6vdeSM+lJVMmtoIO1iv4GQdUI+9SHNxT2cMHtE 7wkH/zfSe4CHOdvWtmF67Aa+9GIfSEmVOOel8V+2LnhXHKN/iuIRMn X-Received: by 2002:a05:6820:982:b0:694:8f5d:3ca with SMTP id 006d021491bc7-6948f5d083dmr9649837eaf.23.1776995209754; Thu, 23 Apr 2026 18:46:49 -0700 (PDT) Received: from host.td.teradata.com ([2600:1700:7c:96e0:48c1:2987:595c:6123]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-42b930afa63sm18229275fac.5.2026.04.23.18.46.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 18:46:49 -0700 (PDT) From: Altan Hacigumus To: Eric Dumazet , Neal Cardwell , Kuniyuki Iwashima , "David S . Miller" , David Ahern , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Enke Chen Subject: [PATCH net v2] tcp: make probe0 timer handle expired user timeout Date: Thu, 23 Apr 2026 18:46:38 -0700 Message-ID: <20260424014639.54110-1-ahacigu.linux@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260414013634.43997-1-ahacigu.linux@gmail.com> References: <20260414013634.43997-1-ahacigu.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit tcp_clamp_probe0_to_user_timeout() computes remaining time in jiffies using subtraction with an unsigned lvalue. If elapsed probing time exceeds the configured TCP_USER_TIMEOUT, the underflow yields a large value. This ends up re-arming the probe timer for a full backoff interval instead of expiring immediately, delaying connection teardown beyond the configured timeout. Fix this by preventing underflow so user-set timeout expiration is handled correctly without extending the probe timer. Fixes: 344db93ae3ee ("tcp: make TCP_USER_TIMEOUT accurate for zero window probes") Link: https://lore.kernel.org/r/20260414013634.43997-1-ahacigu.linux@gmail.com Signed-off-by: Altan Hacigumus --- v2: - Use the existing TCP_TIMEOUT_MIN clamping along with signed @remaining --- net/ipv4/tcp_timer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 8d791a954cd6..322db13333c7 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -50,7 +50,8 @@ static u32 tcp_clamp_rto_to_user_timeout(const struct sock *sk) u32 tcp_clamp_probe0_to_user_timeout(const struct sock *sk, u32 when) { const struct inet_connection_sock *icsk = inet_csk(sk); - u32 remaining, user_timeout; + u32 user_timeout; + s32 remaining; s32 elapsed; user_timeout = READ_ONCE(icsk->icsk_user_timeout); @@ -61,7 +62,7 @@ u32 tcp_clamp_probe0_to_user_timeout(const struct sock *sk, u32 when) if (unlikely(elapsed < 0)) elapsed = 0; remaining = msecs_to_jiffies(user_timeout) - elapsed; - remaining = max_t(u32, remaining, TCP_TIMEOUT_MIN); + remaining = max_t(int, remaining, TCP_TIMEOUT_MIN); return min_t(u32, remaining, when); } -- 2.43.0