Skip to content

Commit dcaf1df

Browse files
author
Paolo Abeni
committed
tcp: check space before adding MPTCP SYN options
JIRA: https://issues.redhat.com/browse/RHEL-115628 Upstream commit: commit 06d64ab Author: MoYuanhao <moyuanhao3676@163.com> Date: Mon Dec 9 13:28:14 2024 +0100 tcp: check space before adding MPTCP SYN options Ensure there is enough space before adding MPTCP options in tcp_syn_options(). Without this check, 'remaining' could underflow, and causes issues. If there is not enough space, MPTCP should not be used. Signed-off-by: MoYuanhao <moyuanhao3676@163.com> Fixes: cec37a6 ("mptcp: Handle MP_CAPABLE options for outgoing connections") Cc: stable@vger.kernel.org Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> [ Matt: Add Fixes, cc Stable, update Description ] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20241209-net-mptcp-check-space-syn-v1-1-2da992bb6f74@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent f197184 commit dcaf1df

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/ipv4/tcp_output.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,10 @@ static unsigned int tcp_syn_options(struct sock *sk, struct sk_buff *skb,
828828
unsigned int size;
829829

830830
if (mptcp_syn_options(sk, skb, &size, &opts->mptcp)) {
831-
opts->options |= OPTION_MPTCP;
832-
remaining -= size;
831+
if (remaining >= size) {
832+
opts->options |= OPTION_MPTCP;
833+
remaining -= size;
834+
}
833835
}
834836
}
835837

0 commit comments

Comments
 (0)