* [PATCH 6.1.y] mptcp: fix possible integer overflow in mptcp_reset_tout_timer
@ 2024-11-25 14:05 Matthieu Baerts (NGI0)
2024-11-25 16:10 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Matthieu Baerts (NGI0) @ 2024-11-25 14:05 UTC (permalink / raw)
To: stable, gregkh
Cc: sashal, MPTCP Upstream, Dmitry Kandybka, Jakub Kicinski,
Matthieu Baerts
From: Dmitry Kandybka <d.kandybka@gmail.com>
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 <d.kandybka@gmail.com>
Link: https://patch.msgid.link/20241107103657.1560536-1-d.kandybka@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ 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) <matttbe@kernel.org>
---
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 1acd4e37a0ea..370afcac2623 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2708,8 +2708,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 +
- TCP_TIMEWAIT_LEN;
+ close_timeout = (unsigned long)inet_csk(sk)->icsk_mtup.probe_timestamp -
+ tcp_jiffies32 + jiffies + TCP_TIMEWAIT_LEN;
/* the close timeout takes precedence on the fail one, and here at least one of
* them is active
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 6.1.y] mptcp: fix possible integer overflow in mptcp_reset_tout_timer
2024-11-25 14:05 [PATCH 6.1.y] mptcp: fix possible integer overflow in mptcp_reset_tout_timer Matthieu Baerts (NGI0)
@ 2024-11-25 16:10 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2024-11-25 16:10 UTC (permalink / raw)
To: stable; +Cc: Matthieu Baerts (NGI0), Sasha Levin
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: b169e76ebad22cbd055101ee5aa1a7bed0e66606
WARNING: Author mismatch between patch and upstream commit:
Backport author: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Commit author: Dmitry Kandybka <d.kandybka@gmail.com>
Status in newer kernel trees:
6.12.y | Not found
6.11.y | Not found
6.6.y | Not found
6.1.y | Not found
Note: The patch differs from the upstream commit:
---
--- - 2024-11-25 10:40:34.024304989 -0500
+++ /tmp/tmp.AFQFGr6Xvw 2024-11-25 10:40:34.014755112 -0500
@@ -1,3 +1,5 @@
+commit b169e76ebad22cbd055101ee5aa1a7bed0e66606 upstream.
+
In 'mptcp_reset_tout_timer', promote 'probe_timestamp' to unsigned long
to avoid possible integer overflow. Compile tested only.
@@ -6,22 +8,31 @@
Signed-off-by: Dmitry Kandybka <d.kandybka@gmail.com>
Link: https://patch.msgid.link/20241107103657.1560536-1-d.kandybka@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+[ 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) <matttbe@kernel.org>
---
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 b0e9a745ea621..a6f2a25edb119 100644
+index 1acd4e37a0ea..370afcac2623 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
-@@ -2722,8 +2722,8 @@ void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout)
+@@ -2708,8 +2708,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);
+- TCP_TIMEWAIT_LEN;
+ close_timeout = (unsigned long)inet_csk(sk)->icsk_mtup.probe_timestamp -
-+ tcp_jiffies32 + jiffies + mptcp_close_timeout(sk);
++ tcp_jiffies32 + jiffies + TCP_TIMEWAIT_LEN;
/* the close timeout takes precedence on the fail one, and here at least one of
* them is active
+--
+2.45.2
+
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y | Success | Success |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-25 16:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-25 14:05 [PATCH 6.1.y] mptcp: fix possible integer overflow in mptcp_reset_tout_timer Matthieu Baerts (NGI0)
2024-11-25 16:10 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox