Skip to content

Commit c0ff6f6

Browse files
Paolo Abenikuba-moo
authored andcommitted
mptcp: fix NULL pointer dereference on fastopen early fallback
In case of early fallback to TCP, subflow_syn_recv_sock() deletes the subflow context before returning the newly allocated sock to the caller. The fastopen path does not cope with the above unconditionally dereferencing the subflow context. Fixes: 36b122b ("mptcp: add subflow_v(4,6)_send_synack()") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent d6a0443 commit c0ff6f6

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

net/mptcp/fastopen.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,18 @@
99
void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subflow,
1010
struct request_sock *req)
1111
{
12-
struct sock *ssk = subflow->tcp_sock;
13-
struct sock *sk = subflow->conn;
12+
struct sock *sk, *ssk;
1413
struct sk_buff *skb;
1514
struct tcp_sock *tp;
1615

16+
/* on early fallback the subflow context is deleted by
17+
* subflow_syn_recv_sock()
18+
*/
19+
if (!subflow)
20+
return;
21+
22+
ssk = subflow->tcp_sock;
23+
sk = subflow->conn;
1724
tp = tcp_sk(ssk);
1825

1926
subflow->is_mptfo = 1;

0 commit comments

Comments
 (0)