From: Paolo Abeni <pabeni(a)redhat.com>
mainline inclusion
from mainline-v6.10-rc4
commit 8031b58c3a9b1db3ef68b3bd749fbee2e1e1aaa3
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IACQHR
CVE: CVE-2024-40931
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
This is strictly related to commit fb7a0d334894 ("mptcp: ensure snd_nxt
is properly initialized on connect"). It turns out that syzkaller can
trigger the retransmit after fallback and before processing any other
incoming packet - so that snd_una is still left uninitialized.
Address the issue explicitly initializing snd_una together with snd_nxt
and write_seq.
Suggested-by: Mat Martineau <martineau(a)kernel.org>
Fixes: 8fd738049ac3 ("mptcp: fallback in case of simultaneous connect")
Cc: stable(a)vger.kernel.org
Reported-by: Christoph Paasch <cpaasch(a)apple.com>
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/485
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
Reviewed-by: Mat Martineau <martineau(a)kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe(a)kernel.org>
Link: https://lore.kernel.org/r/20240607-upstream-net-20240607-misc-fixes-v1-1-1a…
Signed-off-by: Jakub Kicinski <kuba(a)kernel.org>
Conflicts:
net/mptcp/protocol.c
[The conflict occurs because the commit 54f1944ed6d2("mptcp: factor out
mptcp_connect()") and 7439d687b79c("mptcp: avoid a few atomic ops in the
rx path") are not merged]
Signed-off-by: Zhengchao Shao <shaozhengchao(a)huawei.com>
---
net/mptcp/protocol.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 22ed394295a7..e0fc72ab97c3 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2649,6 +2649,7 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
mptcp_subflow_early_fallback(msk, subflow);
WRITE_ONCE(msk->write_seq, subflow->idsn);
+ atomic64_set(&msk->snd_una, subflow->idsn);
do_connect:
err = ssock->ops->connect(ssock, uaddr, addr_len, flags);
--
2.34.1
From: Paolo Abeni <pabeni(a)redhat.com>
mainline inclusion
from mainline-v6.10-rc4
commit 8031b58c3a9b1db3ef68b3bd749fbee2e1e1aaa3
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IACQHR
CVE: CVE-2024-40931
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
This is strictly related to commit fb7a0d334894 ("mptcp: ensure snd_nxt
is properly initialized on connect"). It turns out that syzkaller can
trigger the retransmit after fallback and before processing any other
incoming packet - so that snd_una is still left uninitialized.
Address the issue explicitly initializing snd_una together with snd_nxt
and write_seq.
Suggested-by: Mat Martineau <martineau(a)kernel.org>
Fixes: 8fd738049ac3 ("mptcp: fallback in case of simultaneous connect")
Cc: stable(a)vger.kernel.org
Reported-by: Christoph Paasch <cpaasch(a)apple.com>
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/485
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
Reviewed-by: Mat Martineau <martineau(a)kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe(a)kernel.org>
Link: https://lore.kernel.org/r/20240607-upstream-net-20240607-misc-fixes-v1-1-1a…
Signed-off-by: Jakub Kicinski <kuba(a)kernel.org>
Conflicts:
net/mptcp/protocol.c
[The conflict occurs because the commit 54f1944ed6d2("mptcp: factor out
mptcp_connect()") and 7439d687b79c("mptcp: avoid a few atomic ops in the
rx path") are not merged]
Signed-off-by: Zhengchao Shao <shaozhengchao(a)huawei.com>
---
net/mptcp/protocol.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 613442057a04..c876f93f5b17 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2649,6 +2649,7 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
mptcp_subflow_early_fallback(msk, subflow);
WRITE_ONCE(msk->write_seq, subflow->idsn);
+ atomic64_set(&msk->snd_una, subflow->idsn);
do_connect:
err = ssock->ops->connect(ssock, uaddr, addr_len, flags);
--
2.34.1
From: Paolo Abeni <pabeni(a)redhat.com>
stable inclusion
from stable-v6.6.35
commit f1f0a46f8bb8890b90ab7194f0a0c8fe2a3fb57f
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IACQHR
CVE: CVE-2024-40931
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id…
---------------------------
commit 8031b58c3a9b1db3ef68b3bd749fbee2e1e1aaa3 upstream.
This is strictly related to commit fb7a0d334894 ("mptcp: ensure snd_nxt
is properly initialized on connect"). It turns out that syzkaller can
trigger the retransmit after fallback and before processing any other
incoming packet - so that snd_una is still left uninitialized.
Address the issue explicitly initializing snd_una together with snd_nxt
and write_seq.
Suggested-by: Mat Martineau <martineau(a)kernel.org>
Fixes: 8fd738049ac3 ("mptcp: fallback in case of simultaneous connect")
Cc: stable(a)vger.kernel.org
Reported-by: Christoph Paasch <cpaasch(a)apple.com>
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/485
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
Reviewed-by: Mat Martineau <martineau(a)kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe(a)kernel.org>
Link: https://lore.kernel.org/r/20240607-upstream-net-20240607-misc-fixes-v1-1-1a…
Signed-off-by: Jakub Kicinski <kuba(a)kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Signed-off-by: Zhengchao Shao <shaozhengchao(a)huawei.com>
---
net/mptcp/protocol.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index cfe316ee8789..4f42bd439228 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3708,6 +3708,7 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
WRITE_ONCE(msk->write_seq, subflow->idsn);
WRITE_ONCE(msk->snd_nxt, subflow->idsn);
+ WRITE_ONCE(msk->snd_una, subflow->idsn);
if (likely(!__mptcp_check_fallback(msk)))
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVE);
--
2.34.1