]> git.hungrycats.org Git - linux/commitdiff
ksmbd: keep retry timeout clamp bounds constant
authorNamjae Jeon <linkinjeon@kernel.org>
Mon, 26 Oct 2026 06:26:31 +0000 (15:26 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Nov 2026 17:10:54 +0000 (12:10 -0500)
commit 146c3fc6540e24eef6296395a35bf5b924182e8b upstream.

With CONFIG_HZ=1024, msecs_to_jiffies(1200) includes an overflow check
that calls jiffies_to_msecs(MAX_JIFFY_OFFSET). Its saturation branch
returns MAX_JIFFY_OFFSET, which exceeds the six-second upper bound.
GCC 10.5 carries that branch into clamp_t()'s bounds check and fails to
build ksmbd_tcp_writev() on MIPS.

Compute the 1200 ms lower bound with DIV_ROUND_UP() instead, so both
bounds are compile-time constants. The lower bound still rounds up to
the next jiffy, and the retry interval remains between 1.2 and 6 seconds.

Fixes: c0632d2010ff ("ksmbd: track delivery of queued TCP writes")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202610251743.jztr17Ib-lkp@intel.com/
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/smb/server/transport_tcp.c

index d3de4a1cc7d60f16af0b44e1a9f721fbc63dcaba..af3b6a01862ba071ba29c0276b1a82a19d4e7178 100644 (file)
@@ -696,7 +696,7 @@ accepted:
                lock_sock(sk);
                tx->tracking->retry_after =
                        clamp_t(unsigned long, 6UL * inet_csk(sk)->icsk_rto,
-                               msecs_to_jiffies(1200), 6 * HZ);
+                               DIV_ROUND_UP(1200 * HZ, MSEC_PER_SEC), 6 * HZ);
                release_sock(sk);
                tx->tracking->valid = true;
        }