From d818e9748677eed0d9437b035c552706f2b83a12 Mon Sep 17 00:00:00 2001 From: Dmitry Kandybka Date: Tue, 11 Mar 2025 08:51:19 +0900 Subject: [PATCH] mptcp: fix possible integer overflow in mptcp_reset_tout_timer BugLink: https://bugs.launchpad.net/bugs/2101915 commit b169e76ebad22cbd055101ee5aa1a7bed0e66606 upstream. In 'mptcp_reset_tout_timer', promote 'probe_timestamp' to unsigned long to avoid possible integer overflow. Compile tested only. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Kandybka Link: https://patch.msgid.link/20241107103657.1560536-1-d.kandybka@gmail.com Signed-off-by: Jakub Kicinski [ Conflict in this version because commit d866ae9aaa43 ("mptcp: add a new sysctl for make after break timeout") is not in this version, and replaced TCP_TIMEWAIT_LEN in the expression. The fix can still be applied the same way: by forcing a cast to unsigned long for the first item. ] Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Sasha Levin [koichiroden: applied patch from v6.12.5 cleanly] Signed-off-by: Koichiro Den Signed-off-by: Stefan Bader --- net/mptcp/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index bfa547326d1e..ed7bd37540e8 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2719,8 +2719,8 @@ void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout) if (!fail_tout && !inet_csk(sk)->icsk_mtup.probe_timestamp) return; - close_timeout = inet_csk(sk)->icsk_mtup.probe_timestamp - tcp_jiffies32 + jiffies + - mptcp_close_timeout(sk); + close_timeout = (unsigned long)inet_csk(sk)->icsk_mtup.probe_timestamp - + tcp_jiffies32 + jiffies + mptcp_close_timeout(sk); /* the close timeout takes precedence on the fail one, and here at least one of * them is active